davsclaus opened a new pull request, #24852:
URL: https://github.com/apache/camel/pull/24852
## Summary
Fixes a bug where `QueryResultIterator.next()` hangs the route thread
forever when `queryMore` fails during paginated result iteration with
`streamQueryResult=true`.
Three interrelated bugs in the callback:
- The `exception` parameter was completely ignored — on any failure,
`objectMapper.readValue(null, ...)` would throw
- `latch.countDown()` was inside the `try` block, not in `finally` — any
exception skipped it, deadlocking the route thread
- `latch.await()` had no timeout — the thread would block indefinitely
### Fix
- Check `exception != null` at callback entry and store it in an error holder
- Catch all exceptions (not just `IOException`) and store them in the error
holder
- Move `latch.countDown()` to the `finally` block so it is always reached
- Add a 30-second timeout to `latch.await()`
- After the latch, check the error holder and rethrow on the route thread as
`RuntimeCamelException`
## Test plan
- [x] Added `QueryResultIteratorTest` with 5 tests:
- Single-page iteration (happy path)
- Multi-page iteration (happy path with `queryMore`)
- `queryMore` exception does not hang (synchronous callback)
- `queryMore` exception from separate thread does not hang (async
callback, mimics production)
- Malformed response does not hang (parse error)
- [x] `mvn verify` passes on `camel-salesforce-component`
_Claude Code on behalf of davsclaus_
Co-Authored-By: Claude Opus 4.6 <[email protected]>
--
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]