cluster/zeromq: Fix XSUB threading issues

It is not safe to use the same socket from different threads, but the
current code used the xsub socket directly from the main thread (to setup
subscriptions) and from the internal thread for polling and reading.

Leverage the PAIR socket already in use for forwarding publish operations
to the internal thread also for subscribe and unsubscribe.

The failure mode is/was a bit annoying. Essentially, closing of the
context would hang indefinitely in zmq_ctx_term().
This commit is contained in:
Arne Welzel 2025-01-09 20:50:31 +01:00
parent df78a94c76
commit fa22f91ca4
2 changed files with 86 additions and 38 deletions

View file

@ -162,7 +162,8 @@ export {
## Bitmask to enable low-level stderr based debug printing.
##
## poll debugging: 1 (produce verbose zmq::poll() output)
## poll: 1 (produce verbose zmq::poll() output)
## thread: 2 (produce thread related output)
##
## Or values from the above list together and set debug_flags
## to the result. E.g. use 7 to select 4, 2 and 1. Only use this