CAMEL-25280: camel-snmp - concurrent exchanges on one endpoint must not share the request PDU - #27309
Conversation
…ot share the request PDU SnmpProducer is shared by all the exchanges of an endpoint, and kept one request PDU in a field. The GET_NEXT walk changes that PDU for every request (clear, then the next OID), and SNMP4J sends the same PDU object again when it retries after a timeout. So walks running at the same time on one endpoint changed each other's requests: a walk whose request was retried while another walk ran got the answer for the other walk's last OID, ended its subtree early and returned a silently incomplete result. The producer now creates the request PDU for each exchange. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
davsclaus
left a comment
There was a problem hiding this comment.
LGTM. The request PDU is now built per exchange, so concurrent walks and SNMP4J retries no longer share and mutate one PDU. The latch-based ConcurrentWalkTest is a nice reproduction.
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 of 698 tested, 27 compile-only — current: 9 all testedMaveniverse Scalpel detected 9 affected modules (current approach: 9). Skip-tests mode would test 9 modules (1 direct + 8 downstream), skip tests for 27 (generated code, meta-modules) Modules Scalpel would test (9)
Modules with tests skipped (27)
All tested modules (36 modules, 5m 43s total)Total reactor time: 5m 43s
Top 20 slowest modules:
|
Description
CAMEL-25280
Follow-up of #27242 (CAMEL-25245), as suggested in its review.
SnmpProducerkept one request PDU in a field, created indoStart. The producer of an endpoint is shared by all its concurrent exchanges, and theGET_NEXTwalk changes that PDU for every request (clear(), then the next OID). SNMP4J also encodes the same PDU object again when it retries after a timeout. So walks running at the same time on one endpoint changed each other's requests: a walk whose request was retried while another walk ran got the answer for the other walk's last OID, ended its subtree early and returned an incomplete list, without an error.This change creates the request PDU for each exchange (the code that built it in
doStartmoves to a method thatprocesscalls).Tests:
ConcurrentWalkTest(new): an SNMP4J test agent with two subtrees that does not answer the very first request. A first walk starts; once its first request was dropped, a second walk runs on the same endpoint while the first waits for its retry.[b1, b2]instead of[a1, a2, b1, b2].Conflicts with #27242: both change the lines of the walk loop. The same change applied on top of #27242 passes there too (22 tests); whichever is merged second needs a small rebase (the walk uses the local
pduinstead ofthis.pdu).Target
mainbranch)Tracking
Apache Camel coding standards and style
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.(I built and tested the affected module, including the formatter and import-sort plugins. I did not run the full root build.)
AI-assisted contributions
Co-authored-bytrailers) and the PR description identifies the AI tool used.This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a
Co-Authored-Bytrailer.Claude Code on behalf of allthingssecurity
🤖 Generated with Claude Code