Skip to content

Fix fair_queue tests to match disconnect behavior#220

Merged
rgbkrk merged 3 commits into
masterfrom
fix-fair-queue-tests
Dec 18, 2025
Merged

Fix fair_queue tests to match disconnect behavior#220
rgbkrk merged 3 commits into
masterfrom
fix-fair-queue-tests

Conversation

@rgbkrk
Copy link
Copy Markdown
Member

@rgbkrk rgbkrk commented Dec 18, 2025

PR #207 changed FairQueue to return None immediately when any stream ends (to properly handle disconnects). The tests from PR #213 were written with the old behavior in mind where the queue would continue until all streams finished.

Updated tests to expect None when the first stream ends rather than waiting for all streams to complete or return Pending.

cc @jbbjarnason

PR #207 changed FairQueue to return None immediately when any stream
ends (to properly handle disconnects). The tests from PR #213 were
written with the old behavior in mind where the queue would continue
until all streams finished.

Updated tests to expect None when the first stream ends rather than
waiting for all streams to complete or return Pending.
@rgbkrk rgbkrk requested a review from poyea December 18, 2025 22:48
PR #207 changed fair_queue to return None immediately when any stream
ends. This broke multi-client scenarios like REP sockets with many
concurrent clients - when the first client disconnected, the server
would stop receiving from all remaining clients.

This commit reverts to the previous behavior: when a stream ends,
continue polling other streams. Only return None when truly all streams
are exhausted.

Changes:
- fair_queue: continue polling after stream disconnect
- Updated tests to expect all streams to be consumed
- REP socket: restored None case handling for when queue is empty
@rgbkrk
Copy link
Copy Markdown
Member Author

rgbkrk commented Dec 18, 2025

Ok so this surfaced an issue on a REP socket with 100 concurrent clients. The first client to finish would cause the server to stop receiving from the remaining 99 clients.

The test was written correctly - it expected Pending when a stream
ends but other streams remain. The implementation change in PR #207
broke this expectation. Our fix restores the behavior the test expected.
@rgbkrk
Copy link
Copy Markdown
Member Author

rgbkrk commented Dec 18, 2025

This basically reverts #207 in the end. Sadly multiclients were broken by the None propagation from the fair queue disconnects.

@rgbkrk rgbkrk merged commit 1a6d5c1 into master Dec 18, 2025
3 checks passed
@rgbkrk rgbkrk deleted the fix-fair-queue-tests branch December 18, 2025 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants