Skip to content

fix slow subscriber bug in zmq runner - #251

Merged
sneakers-the-rat merged 12 commits into
mainfrom
fix-zmq-pub-race
Jul 22, 2026
Merged

fix slow subscriber bug in zmq runner#251
sneakers-the-rat merged 12 commits into
mainfrom
fix-zmq-pub-race

Conversation

@sneakers-the-rat

@sneakers-the-rat sneakers-the-rat commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

I think this should actually fix the sporadically failing tests once and for all...

previously we had fixed a hung thread/quitting error on the command node that was causing problems, but that unmasked another source of sporadic error.

Basically the issue is that we were signaling that every node was "ready" once it had initiated the subscription to its upstream nodes, and most of the time this was fine.

However there was a race condition where the subscription was initiated but not completed on the publisher side, which caused the upstream node to run and emit events that were never received by the downstream nodes.

to fix this, change publisher sockets to XPUB which allows polling for subscription events, and then subscribe to some empty topic like __subscription__:{node_id}. The publishers can then learn who is subscribed to them and re-announce their identification, which now includes the list of the nodes that are subscribed to them, so that subscribers can know when they have been successfully subscribed. only then do we mark a node as being "ready".

this makes for a decent amount of chatter on startup, but that's an optimization to be done after we have gotten the behavior rock solid.

I also went and did the pdm workspaces swap, since the CI time expanded with noob core and it became worth it to use gh actions caches for the deps, where it wasn't before


📚 Documentation preview 📚: https://noob--251.org.readthedocs.build/en/251/

@codspeed-hq

codspeed-hq Bot commented Jul 21, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 17.38%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 (👁 1) regressed benchmark
✅ 7 untouched benchmarks
⏩ 8 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
👁 Simulation test_long_add[ZMQRunner-testing-long-add] 2.2 ms 2.6 ms -17.38%

Comparing fix-zmq-pub-race (e7a72a6) with main (6a6c5d4)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coveralls

coveralls commented Jul 21, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 80.329% (-0.3%) from 80.619% — fix-zmq-pub-race into main

@sneakers-the-rat
sneakers-the-rat merged commit 7acb004 into main Jul 22, 2026
81 checks passed
@sneakers-the-rat
sneakers-the-rat deleted the fix-zmq-pub-race branch July 22, 2026 02:28
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