damccorm opened a new pull request, #41634:
URL: https://github.com/apache/beam/pull/41634

   Note: this PR was auto-generated by tooling. Before moving it out of draft, 
the author has done a full review of the PR, specifically evaluating it on the 
following criteria:
   
   - The PR is an appropriate fix for the issue (e.g. we're not changing a test 
to avoid a bug)
   - The PR is a simple fix to the issue (e.g. we're not adding infra when we 
could just modify a test)
   - The PR is not covering for other problems (e.g. if we're bumping timeouts, 
it is not because we're covering for a performance problem)
     
   Full details of the methodology of generation and review can be found here - 
https://docs.google.com/document/d/14lj7ECVov4T4EdwmIzNlWrRGE3lLDMOwX5xUMGzaLoc/edit?usp=sharing
   
   If you have concerns with the PR or with the underlying methodology used to 
generate this, please comment below - they will be addressed by the author not 
the tooling :)
   
   ## Summary
   
   Fixes two recurring test-fixture bugs in `JmsIOIT` / `CommonJms` (`PreCommit 
Java Jms IO Direct`):
   1. Disables unused ActiveMQ advisory topics in `CommonJms.startBroker()` to 
eliminate concurrent `vm://localhost` `NullPointerException` races.
   2. Enables `jms.receiveNoWaitLocalOnly=true` on Qpid AMQP connections used 
by `JmsIOIT` for non-`CLIENT_ACKNOWLEDGE` modes to prevent `receiveNoWait()` 
from hanging for 60 seconds on ActiveMQ 5.x's ignored AMQP drain pull.
   
   ## Root Cause
   
   1. **ActiveMQ advisory topic initialization race (`vm://localhost`)**: 
`CommonJms.startBroker()` left `advisorySupport` enabled (the ActiveMQ 
default). When 16 DirectRunner worker threads start `ActiveMQConnection` 
instances concurrently over `vm://localhost`, ActiveMQ's unsynchronized lazy 
initialization of `ActiveMQDestination.getDestinationPaths()` on 
`AdvisorySupport.TEMP_DESTINATION_COMPOSITE_ADVISORY_TOPIC` can throw a 
`NullPointerException` in `DestinationMapNode.appendMatchingValues`.
   2. **Qpid AMQP `receiveNoWait()` 60s drain hang (`amqp://localhost`)**: For 
`INDIVIDUAL_ACKNOWLEDGE` and `CLIENT_ACKNOWLEDGE_UNSAFE`, `JmsIOIT` uses 
default prefetch (1000). Once all 10,000 messages have been consumed and the 
local prefetch buffer is empty, `JmsIO.UnboundedJmsReader.advance()` calls 
`consumer.receiveNoWait()`. With Qpid JMS's default 
`jms.receiveNoWaitLocalOnly=false`, Qpid issues an AMQP `FLOW(drain=true)` 
pull; ActiveMQ 5.x's `PrefetchSubscription.pullMessage()` ignores `MessagePull` 
whenever `prefetchSize > 0`, so `receiveNoWait()` blocks for the full 60-second 
`amqp.drainTimeout`. That prevents DirectRunner from finishing the bundle and 
finalizing `JmsCheckpointMark` to acknowledge the messages before `JmsIOIT`'s 
60s `readTimeout` expires (`All messages should be acknowledged expected:<0> 
but was:<10000>`).
   
   ## Fix
   
   - Set `broker.setAdvisorySupport(false)` in `CommonJms.startBroker()`.
   - Add `CommonJms.createConnectionFactoryWithLocalReceiveNoWait()` appending 
`jms.receiveNoWaitLocalOnly=true` for `amqp://` URLs and use it in `JmsIOIT` 
for non-`CLIENT_ACKNOWLEDGE` modes (leaving 
`CommonJms.createConnectionFactory()` unchanged for `JmsIOTest`'s direct 
synchronous `reader.start()` tests).
   
   ## Verification
   
   - Ran `./gradlew :sdks:java:io:jms:spotlessCheck 
:sdks:java:io:jms:checkstyleTest :sdks:java:io:jms:test --rerun 
:sdks:java:io:jms:integrationTest --rerun` locally:
     - `spotlessCheck` & `checkstyleTest`: PASS
     - `:sdks:java:io:jms:test`: 83/83 passed
     - `:sdks:java:io:jms:integrationTest`: 6/6 passed
   
   ### Recent Occurrences
   
   3 failing `master` workflow runs in the past 3 weeks:
   - `PreCommit Java Jms IO Direct` (3 runs):
     - https://github.com/apache/beam/actions/runs/42628668151 (2026-11-09)
     - https://github.com/apache/beam/actions/runs/42777801131 (2026-11-10)
     - https://github.com/apache/beam/actions/runs/44999863887 (2026-11-22)


-- 
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]

Reply via email to