Question about race condition with nackAll and purgeQueue

26 views
Skip to first unread message

Amir B

unread,
May 10, 2021, 9:04:15 AM5/10/21
to rabbitmq-users
Hello,

I investigate few flaky unit tests that very rarely fail in our test suite for opentelemetry instrumentation for amqplib package in nodejs

Link to the repo:

I suspect that the issue is somehow related to rabbitmq not purging a queue correctly after nackAll.

My use case is:

I run rabbitmq in docker in the CI (github actions):

Test #1 (test nackAll behaviour)

- send 2 messages to queue
- consume the 2 messages from the queue
- call nackAll on the queue (with requeue).

Test #2 (test reject behaviour):

- purge the queue from messages (at this point I expect the queue to be empty)
- send 1 message to queue
- consume message from the queue

for test #2 I expect that consume will return only 1 message, as I purged the queue before starting the test. In reality, I do get 1 message most of the times, but one out of few dozens runs I sometimes get 3 messages which causes the tests to fail (probably the 2 nackAll messages from the previous test which were not cleaned correctly with purgeQueue)

I would guess that rabbitmq internally is not executing the commands synchronously. Would appreciate any help or insights on this issue as I'm kind of stuck currently with making the tests deterministic with rabbitmq api.

Thanks, Amir

Amir B

unread,
May 11, 2021, 11:54:49 AM5/11/21
to rabbitmq-users
after more debugging, I now suspect that the issue is related to my setup (couldn't find it yet, but that's where the clues lead).
Reply all
Reply to author
Forward
0 new messages