You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by "gurpartap3697 (via GitHub)" <gi...@apache.org> on 2026/03/30 18:20:51 UTC
[PR] Fix flaky XACompletionTest by adding wait for async states [activemq]
gurpartap3697 opened a new pull request, #1862:
URL: https://github.com/apache/activemq/pull/1862
XACompletionTest.testStatsAndBrowseAfterAckPreparedRolledback was failing intermittently:
```
Error: XACompletionTest.testStatsAndBrowseAfterAckPreparedRolledback:254 size 0 expected:<0> but was:<10>
```
ref: https://github.com/apache/activemq/actions/runs/23623154131/job/68806975829
The test relied on immediate JMX state, which is asynchronous and can lead to flakiness.
--
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: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]
Posted by "gurpartap3697 (via GitHub)" <gi...@apache.org>.
gurpartap3697 commented on PR #1862:
URL: https://github.com/apache/activemq/pull/1862#issuecomment-4157532044
Thanks @jbonofre for feedback! I updated the pr with suggested changes.
--
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: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]
Posted by "gurpartap3697 (via GitHub)" <gi...@apache.org>.
gurpartap3697 commented on code in PR #1862:
URL: https://github.com/apache/activemq/pull/1862#discussion_r3011693901
##########
activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/XACompletionTest.java:
##########
@@ -249,6 +249,7 @@ public void testStatsAndBrowseAfterAckPreparedRolledback() throws Exception {
resource.recover(XAResource.TMSTARTRSCAN);
resource.recover(XAResource.TMNOFLAGS);
+ Wait.waitFor(() -> proxy.getInFlightCount() == 0L && proxy.cursorSize() == 0);
Review Comment:
Good point — thanks for calling that out.
I initially assumed that inFlightCount == 0 would imply the queue state (including queueSize) had fully settled. I've updated the wait condition to include getQueueSize()
--
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: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #1862:
URL: https://github.com/apache/activemq/pull/1862
--
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: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #1862:
URL: https://github.com/apache/activemq/pull/1862#discussion_r3011599712
##########
activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/XACompletionTest.java:
##########
@@ -249,6 +249,7 @@ public void testStatsAndBrowseAfterAckPreparedRolledback() throws Exception {
resource.recover(XAResource.TMSTARTRSCAN);
resource.recover(XAResource.TMNOFLAGS);
+ Wait.waitFor(() -> proxy.getInFlightCount() == 0L && proxy.cursorSize() == 0);
Review Comment:
I suggest to wrap `Watit.waitFor()` in a `assertTrue` for better diagnostics on failure:
```suggestion
assertTrue("Timed out waiting for inFlight and cursor to clear",
Wait.waitFor(() -> proxy.getInFlightCount() == 0L && proxy.cursorSize() == 0));
```
##########
activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/XACompletionTest.java:
##########
@@ -249,6 +249,7 @@ public void testStatsAndBrowseAfterAckPreparedRolledback() throws Exception {
resource.recover(XAResource.TMSTARTRSCAN);
resource.recover(XAResource.TMNOFLAGS);
+ Wait.waitFor(() -> proxy.getInFlightCount() == 0L && proxy.cursorSize() == 0);
Review Comment:
The wait condition doesn't cover `getQueueSize()`. The wait checks `getInFlightCount() == 0 && cursorSize() == 0`, but the very next assertion also checks `getQueueSize() == 10`.
If `getQueueSize()` is also subject to async updates, it could still flake.
Worth considering whether to include it in the wait condition.
--
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: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on PR #1862:
URL: https://github.com/apache/activemq/pull/1862#issuecomment-4163094457
@gurpartap3697 good job ! I will merge as soon as CI is green.
--
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: gitbox-unsubscribe@activemq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org
For additional commands, e-mail: gitbox-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact