allthingssecurity opened a new pull request, #27242: URL: https://github.com/apache/camel/pull/27242
# Description [CAMEL-25245](https://issues.apache.org/jira/browse/CAMEL-25245) The `GET_NEXT` walk of `SnmpProducer` keeps requesting the OID of the last variable binding while its string starts with the walked OID: - **End of the MIB view.** The agent answers the last GETNEXT with the requested OID and `endOfMibView` (SNMPv2c/v3) or with `noSuchName` (SNMPv1). That OID still matches, so the producer requested the same OID again forever, adding a message each time: the exchange never completed and the list grew until out of memory. This happens whenever the walk reaches the end of what the agent exposes: a walk of the whole tree, or of the last subtree of a restricted view (the stock Debian/Ubuntu `snmpd.conf` gives `public` only the `systemonly` view, so a walk of `1.3.6.1.2.1` hits it). - **String prefix.** `1.3.6.1.4.1.2021.1.0` was taken as part of `1.3.6.1.4.1.2`, so the walk ran into the next subtree. - **Timeout.** A request without answer ended the walk silently: an unreachable agent gave an empty list, a timeout half way a partial list, both as success (`GET` throws `TimeoutException`). This change: the walk fails with `TimeoutException` when there is no response, ends on `noSuchName`, on an exception value (`endOfMibView`, ...), on an OID that does not increase, or on an OID outside the subtree (`OID.startsWith(OID)`), and fails on other agent errors. The upgrade guide for 4.23 gets a note. Tests: - `WalkOIDEndTest` (new, 5 tests) with its own SNMP4J test agent (it stops repeating after 20 identical requests so that the test without the fix ends): end of the MIB view (SNMPv2c `endOfMibView`, SNMPv1 `noSuchName`), the neighbouring subtree, an agent error (`genErr`) and no agent. - Without the change all five fail: 21 messages instead of 1 at the end of the MIB view (both versions), 2 instead of 1 for the neighbouring subtree, 20 messages and no exception for `genErr`, and an empty list without exception when no agent answers. - With the change all camel-snmp tests pass: 20 tests, 0 failures (`WalkOIDTest` unchanged). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally 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 - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) 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-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
