Closed quantimnot closed 2 years ago
I checked your code and it seems correct; after further investigation it is indeed a bug in the async receive/send proc. I'll fix it in my next PR.
Also, I read this comment in zmq.nim, but I don't know if it applies:
When using asynchrone procs, be careful of the internal state of the ZMQ Socket. Some Socket (such as REP/REQ) cannot send two message in a row without a receive (or vice-versa)
When using asynchronous procedure you don't necessarily control in which order your proc gets executed. Some socket (mostly REP / REQ) have an internal state machine and will enter a blocked state if you perform operation out of order;
For instance in a REQ socket doing send -> receive -> send
works but send -> send -> receive
will block after the second send
. PUB / SUB is not a synchrone pattern in ZMQ so you shouldn't have any trouble with async.
@quantimnot This should be fixed with release v1.3.0
I'm not solid on asyncdispatch, orc, or zmq. I may be doing something wrong, but here is the situation I've run into.
Run with ORC
Run with ORC Output
Run with REFC
Run with REFC Output
I also got ORC to work when I commented out the
ZConnection
destructor in connections.nim.Another observation is that commenting out the
publisher.send("topic", SNDMORE)
line in the publisher will also make the subscriber work (without the topic of course).Also, I read this comment in zmq.nim, but I don't know if it applies: