Skip to content

Disable ActiveMQ advisory topics and AMQP receiveNoWait remote drain in JmsIOIT - #41634

Draft
damccorm wants to merge 1 commit into
masterfrom
fix/jmsio-it-advisory-and-amqp-drain
Draft

damccorm wants to merge 1 commit into
masterfrom
fix/jmsio-it-advisory-and-amqp-drain

Conversation

@damccorm

Copy link
Copy Markdown
Contributor

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:

@damccorm damccorm added the test-failure-cleanup Automated test health and flake cleanup PRs label Nov 24, 2026
@damccorm

Copy link
Copy Markdown
Contributor Author

/gemini review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR resolves two recurring test-fixture issues in CommonJms and JmsIOIT: an ActiveMQ advisory topic lazy-initialization NullPointerException race under concurrent vm:// connections, and a 60-second hang in Qpid JMS receiveNoWait() when using non-zero prefetch against ActiveMQ 5.x over AMQP. The changes are minimal, well-scoped to the test infrastructure, and properly preserve synchronous behavior for unit tests in JmsIOTest.

🔍 General Feedback

  • Disabling advisorySupport on the embedded BrokerService in CommonJms.startBroker() cleanly avoids the unsynchronized destination path initialization race on TEMP_DESTINATION_COMPOSITE_ADVISORY_TOPIC without affecting test coverage.
  • Adding createConnectionFactoryWithLocalReceiveNoWait() with jms.receiveNoWaitLocalOnly=true for amqp:// connections in JmsIOIT directly addresses the unacknowledged message timeout caused by ActiveMQ 5.x ignoring AMQP drain pulls when prefetch is enabled.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions github-actions Bot added java io jms size/s S: 10-49 lines changed labels Nov 24, 2026
@damccorm damccorm added the ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

io java jms ready-for-human Draft PR with all checks passing and all review comments resolved, ready for human review size/s S: 10-49 lines changed test-failure-cleanup Automated test health and flake cleanup PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant