question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Messages being retroactively nack'd in confirm mode with queue limits

See original GitHub issue

I run a single producer and consumer (both using SelectConnection), writing to and reading from a single queue whose maximum size has been limited:

{
    'x-max-length': 10,
    'x-overflow': 'reject-publish'
}

Channels are configured with publisher confirms (confirm_delivery) and log the individual acks and nacks. Sometimes (about once in 50k messages), a nack will occur that contradicts a multi-ack immediately before it. The confirmation messages seem to have been reacted to in the wrong order. An example:

2018-01-02 18:31:56,763 - root - INFO - ack multi 3460 
2018-01-02 18:31:56,763 - root - INFO - nack multi 3459 

Messages up to tag 3460 are ack’d but then those up to 3459 are nack’d. This causes the nack’d messages to be lost (since they are never republished). Things would have worked fine had the messages been processed in the opposite (and correct) order.

Is there something obviously wrong I might be doing? Please let me know if I can provide you with any more information. I’m using pika 0.11.2 with RabbitMQ 3.7.1. The issue persists when using pika’s master as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
vitaly-kruglcommented, May 10, 2018

@sbidin, @lukebakken: I think I may have found a possible bug in user code that can explain this issue:

    def _on_message_nack(self, tag_to: int, multiple: bool) -> None:
        tag_from = self.last_nack + 1 if multiple else tag_to
        ....

I think that the line tag_from = self.last_nack + 1 if multiple else tag_to should instead be

tag_from = max(self.last_nack, self.last_ack) + 1 if multiple else tag_to

because the multi-nack would presumably apply to all messages since the most recent ack or nack from the broker.

And ditto regarding user’s _on_message_ack() implementation.

1reaction
vitaly-kruglcommented, May 10, 2018

@lukebakken, since the queue is configured to Max out at 10, I suspect this becomes reproducible when the consumer process is occasionally not keeping up with the producer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trade Regulation Rule on Commercial Surveillance and ...
First, the FTC Act limits the remedies that the Commission may impose in enforcement actions on companies for violations of Section 5.
Read more >
zxcvbn-async.js
... b/core/assets/vendor/zxcvbn/zxcvbn-async.js new file mode 100644 index ... ,9999,rascal,hitman,mistress,bbbbbb,peekaboo,naked,budlight,electric,sluts ...
Read more >
AWS Solutions Architect - Quiz Flashcards
Amazon SQS is a managed message queuing service. ... is not catastrophic, you would like to drain it so that customers get their...
Read more >
Commercial Surveillance and Data Security
First, the FTC Act limits the remedies that the Commission may impose in enforcement actions on companies for violations of Section 5.
Read more >
Turnitin Integrity - Release Notes
If you enable Turnitin for an assignment after submissions have already been made, we will now queue these for report generation the next...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found