-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reader: incorrect total_rdy update logic when sending new RDY count #175
Comments
total_rdy
update logic when sending new RDY
count
@alpaker thanks for the report, but I think https://github.com/nsqio/pynsq/blob/master/nsq/reader.py#L455 addresses that edge case? |
That doesn't appear to prevent the issue, unfortunately. Suppose we have
But at this point
is Here's a demonstration. Run 4 local
Send a couple of msgs to each instance:
Client code:
Start client and observe that we have 4 msgs in flight, despite a configured
|
I stand corrected! Thanks for the detailed debugging info, are you interested in working up a fix? |
Will do! |
In
Reader._send_rdy()
the following block is responsible for updating the reader'stotal_rdy
attribute:Here
value
represents the desired newRDY
count; thus ifconn.send_rdy(value)
succeeds we'll haveconn.rdy == value
. As a result the above will leavetotal_rdy
unchanged. Since there's no other spot in whichtotal_rdy
is increased, it never gets above its initial value of 0.One behavioral consequence of this: Even if
max_in_flight
is less than thensqd
connection count, every connection will get an initialRDY
count of 1, and so themax_in_flight
constraint can be violated immediately after a reader begins consuming messages.For comparison, the go client does this:
The text was updated successfully, but these errors were encountered: