Skip to content

fix: avoid ZMQ slow-joiner loss on pipeline connect - #297

Open
chrisk314 wants to merge 1 commit into
mainfrom
fix/zmq-slow-joiner
Open

chrisk314 wants to merge 1 commit into
mainfrom
fix/zmq-slow-joiner

Conversation

@chrisk314

Copy link
Copy Markdown
Contributor

Problem

_ZMQPipelineConnectorProxy.connect_recv returned as soon as the SUB socket was connected, but a subscription needs a round trip through the proxy before the XPUB side starts forwarding. A sender that connected and published immediately could therefore have its first messages dropped (the classic ZMQ slow-joiner problem). This surfaced as a flake in the Ray + ZMQ proxy integration test on GitHub Actions.

Change

  • Extend the settle delay in connect_recv from 0.1s to 0.5s, which covered the observed propagation window in local reproduction.
  • Mark the affected integration test @pytest.mark.flaky(reruns=3) so a residual race is retried rather than failing the run.

Notes

This is split out of #284, where it was originally found and diagnosed - it is unrelated to the message data classes and belongs in its own review.

The delay is a mitigation rather than a fix. A proper solution would confirm subscription propagation (e.g. a probe message with acknowledgement, or a subscribe/forward handshake) instead of guessing a wait; happy to follow up that way if preferred.

No issue is filed for this yet.

Fixes #None

`_ZMQPipelineConnectorProxy.connect_recv` returned as soon as the SUB socket was
connected, but a subscription takes a round trip through the proxy before the XPUB side
starts forwarding. A sender that connected and published immediately could therefore
have its first messages dropped, which surfaced as a flake in the Ray + ZMQ proxy
integration test on GitHub Actions.

- Extend the settle delay from 0.1s to 0.5s, which covered the observed propagation
  window in local reproduction.
- Mark the affected integration test as flaky with 3 reruns, so a residual race is
  retried rather than failing the run.

Split out of #284, where it was originally found: it is unrelated to the message data
classes and deserves its own review. The delay is a mitigation, not a fix; a proper
solution would confirm subscription propagation instead of waiting.
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Benchmark comparison for 894671bb (base) vs 3757b2b8 (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.14-64bit/0001_base)     534.1964 (1.0)      552.7469 (1.01)     541.3358 (1.00)     6.8481 (1.92)     539.6903 (1.00)     5.1630 (1.01)          2;1  1.8473 (1.00)          5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.14-64bit/0001_pr)         535.5735 (1.00)     544.7210 (1.0)      539.4150 (1.0)      3.5658 (1.0)      539.2918 (1.0)      5.1000 (1.0)           2;0  1.8539 (1.0)           5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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.

1 participant