Skip to content

NetMQ: first messages lost before subscribers connect (slow joiner) #102

Closed

Description

@christopherread

The NetMQ transport tests (Obvs.NetMQ.Tests, Category=Explicit) pass locally (10 of 11 runs on a Mac) but often fail on GitHub Actions runners. They were tried in the CI broker step in #82 and taken out again:

  • TestPublishSubscribe: TestMessage1 1 not received. The first message published is lost.
  • TestServiceBusWithNetMq: assertion TestCommand1 fails. The first command never reaches the service.

Likely cause: ZeroMQ's "slow joiner" behaviour. MessagePublisher creates and binds its socket lazily on the first publish, then sends immediately, before subscribers have finished connecting. PUB/SUB drops messages sent before a subscription is established. Slower runners make it more likely.

This affects real users too: in Obvs.NetMQ, the first messages published after startup can be silently dropped.

Possible fixes:

  • In the library: create and bind publisher sockets when the endpoint is created rather than on first publish. Optionally wait briefly, or use a handshake, before reporting ready.
  • In the tests: wait until subscribers are connected (for example, publish until one message is received) before asserting.

Done when the NetMQ tests pass reliably in CI and are added to the "Test transports against brokers" step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions