[zeromq-dev] Unexpected routing ID with ZMQ_ROUTER_HANDOVER
Eric Badger
ebadger at gigaio.com
Mon Dec 30 22:01:55 CET 2019
Hi zeromq-dev,
I'm running some (pyzmq) client/server code with a server ROUTER
socket which sets ROUTER_HANDOVER. The clients are DEALERs which all
set their ROUTING_ID manually to a string value. However, I find that
in some cases during handover, the ROUTER side will see a message with
a routing ID that is not what the client set. It seems to be an ID
generated internally by ZMQ. Is this an expected case that a ROUTER
using ROUTER_HANDOVER must handle? Or is something misbehaving here?
Here's a simple client/server example that I find can generally show
this behavior within a couple of tries:
https://pastebin.com/WVJF3sxj
To run it, start a server, and then 2 batches of 4 clients like so:
$ ./serv.py
$ for i in $(seq 1 2); do for j in $(seq 1 4); do (./client.py $j &) ;
done ; sleep 3; done
Usually, the server will see the routing ID as set, printing something
like this:
raw routing id: b'myroutingid4'
But sometimes, it will get a non-string value like so:
raw routing id: b'\x00k\x8bEi'
Traceback (most recent call last):
File "./serv.py", line 21, in <module>
print("decoded routing id: {}".format(wid.decode()))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position
2: invalid start byte
I've found this behavior on these test systems:
- CentOS 7.7, Python 3.6.8, libzmq 4.3.2, pyzmq 18.1.1
- Fedora 30, Python 3.7.5, libzmq 4.3.2, pyzmq 18.1.1
- Ubuntu 16.0.4, Python 3.5.2, libzmq 4.3.2, pyzmq 18.1.0
Any insights appreciated.
Thanks,
Eric
More information about the zeromq-dev
mailing list