z25 / pyZOCP

Python ZOCP implementation (Z25 Orchestration Control Protocol)
GNU Lesser General Public License v3.0
33 stars 5 forks source link

pyZOCP broken with newer pyzmq (windows only?) #88

Open fieldOfView opened 7 years ago

fieldOfView commented 7 years ago

After a bit of an hiatus, I can't get pyZOCP to run after installing pyzmq with pip install pyzmq. This (currently) installs pyzmq-16.0.2. Polling the Pyre object never returns anything. Installing pyzmq 14.5 makes it work again. The change seems to have happened here: https://github.com/zeromq/pyzmq//compare/v14.5.0...v14.7.0

Interestingly the chat.py example in the Pyre project works just fine with modern versions of pyzmq. Running the chat example while creating pyZOCP nodes also shows that the nodes are ENTERing the ZOCP group, so that part is working.

sphaero commented 7 years ago

just a quick test

virtualenv pytest -p python3
cd pytest/
. ./bin/activate
pip install pyzmq
pip install https://github.com/zeromq/pyre/archive/master.zip
pip install https://github.com/z25/pyZOCP/archive/master.zip

then running a simple_node.py

~/src/pyZOCP/examples [pytest] master(+1/-0) 1m23s ± python3 simple_node.py 
DEBUG:zocp.zocp:ZOCP modified by self with {'myBool': {'typeHint': 'bool', 'subscribers': [], 'access': 'rwe', 'value': True}}
DEBUG:zocp.zocp:ZOCP modified by self with {'myFloat': {'typeHint': 'flt', 'subscribers': [], 'access': 'rws', 'max': 5.0, 'step': 0.1, 'value': 2.3}}
DEBUG:zocp.zocp:ZOCP modified by self with {'myInt': {'typeHint': 'int', 'subscribers': [], 'access': 'rwes', 'max': 10, 'step': 1, 'value': 10, 'min': -10}}
DEBUG:zocp.zocp:ZOCP modified by self with {'myPercent': {'typeHint': 'percent', 'subscribers': [], 'access': 'rw', 'value': 12}}
DEBUG:zocp.zocp:ZOCP modified by self with {'myVec2': {'typeHint': 'vec2f', 'subscribers': [], 'access': 'rwes', 'value': [0, 0]}}
DEBUG:pyre.pyre_node:Node is joining group ZOCP
DEBUG:pyre.zbeacon:Available interfaces: [{'enp0s25': {17: {'addr': '00:21:cc:c1:5c:14'}}}, {'wwp0s20u4i6': {17: {'addr': '02:15:e0:ec:01:00'}}}, {'wlp3s0': {17: {'addr': '8c:70:5a:48:5c:f4'}, 2: {'netmask': '255.255.255.0', 'broadcast': '192.168.18.255', 'addr': '192.168.18.114'}, 10: {'scope': 4, 'netmask': 'ffff:ffff:ffff:ffff::', 'addr': 'fe80::d096:baae:16c1:299a'}}}, {'lo': {2: {'netmask': '255.0.0.0', 'addr': '127.0.0.1'}, 10: {'netmask': 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 'addr': '::1'}}}]
DEBUG:pyre.zbeacon:Checking out interface enp0s25.
DEBUG:pyre.zbeacon:No data_2 found for interface enp0s25.
DEBUG:pyre.zbeacon:Checking out interface wwp0s20u4i6.
DEBUG:pyre.zbeacon:No data_2 found for interface wwp0s20u4i6.
DEBUG:pyre.zbeacon:Checking out interface wlp3s0.
DEBUG:pyre.zbeacon:Finished scanning interfaces.
DEBUG:pyre.zbeacon:Address: 192.168.18.114
DEBUG:pyre.zbeacon:Network: 192.168.18.0
DEBUG:pyre.zbeacon:Broadcast: 192.168.18.255
DEBUG:pyre.zbeacon:Interface name: wlp3s0
DEBUG:pyre.zbeacon:Set up a broadcast beacon to 192.168.18.255:5670
DEBUG:pyre.pyre_peer:Connecting to peer 759ae8a1-18f7-4e52-a0d4-99e3f7b6a4b9 on endpoint tcp://192.168.18.114:38517
DEBUG:pyre.pyre_peer:ZOCP-Test send HELLO to peer=notset sequence=1
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv HELLO from peer=notset sequence=1
DEBUG:pyre.pyre_node:(ZOCP-Test) ENTER name=urwMonitor endpoint=tcp://192.168.18.114:38517
DEBUG:pyre.pyre_node:(ZOCP-Test) JOIN name=urwMonitor group=ZOCP
DEBUG:zocp.zocp:ZRE ENTER    :ZOCP-Test: urwMonitor
DEBUG:zocp.zocp:ZRE JOIN     :ZOCP-Test: urwMonitor joined group b'ZOCP'
DEBUG:pyre.pyre_peer:ZOCP-Test send WHISPER to peer=urwMonitor sequence=2
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv WHISPER from peer=urwMonitor sequence=2
DEBUG:zocp.zocp:ZRE WHISPER  :ZOCP-Test: urwMonitor whispered: [b'{"GET": null}']
DEBUG:pyre.pyre_peer:ZOCP-Test send WHISPER to peer=urwMonitor sequence=3
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv WHISPER from peer=urwMonitor sequence=3
DEBUG:zocp.zocp:ZRE WHISPER  :ZOCP-Test: urwMonitor whispered: [b'{"SUB": ["35323755e69a4a6dbf2b4402221ce106", null, "759ae8a118f74e52a0d499e3f7b6a4b9", null]}']
DEBUG:zocp.zocp:ZOCP PEER SUBSCRIBED:ZOCP-Test: urwMonitor subscribed to all emitters
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv WHISPER from peer=urwMonitor sequence=4
DEBUG:zocp.zocp:ZRE WHISPER  :ZOCP-Test: urwMonitor whispered: [b'{"MOD": {}}']
DEBUG:zocp.zocp:ZOCP PEER MODIFIED:ZOCP-Test: urwMonitor modified {}
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv WHISPER from peer=urwMonitor sequence=5
DEBUG:zocp.zocp:ZRE WHISPER  :ZOCP-Test: urwMonitor whispered: [b'{"SET": {"myPercent": {"value": 13}}}']
DEBUG:zocp.zocp:ZOCP ZOCP-Test modified by urwMonitor with {'myPercent': {'value': 13}}
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv WHISPER from peer=urwMonitor sequence=6
DEBUG:zocp.zocp:ZRE WHISPER  :ZOCP-Test: urwMonitor whispered: [b'{"SET": {"myPercent": {"value": 14}}}']
DEBUG:zocp.zocp:ZOCP ZOCP-Test modified by urwMonitor with {'myPercent': {'value': 14}}
DEBUG:pyre.pyre_peer:(ZOCP-Test) recv WHISPER from peer=urwMonitor sequence=7
DEBUG:zocp.zocp:ZRE WHISPER  :ZOCP-Test: urwMonitor whispered: [b'{"SET": {"myPercent": {"value": 15}}}']
DEBUG:zocp.zocp:ZOCP ZOCP-Test modified by urwMonitor with {'myPercent': {'value': 15}}

Seems to work here

pip has these listed: pyre (0.3) pyzmq (16.0.2) pyZOCP (0.1)

system has libzmq5:amd64 4.1.5-2

(Debian Stretch)

fieldOfView commented 7 years ago

Like I thought, it's probably windows-only. Could be in the bundled libsodium or libzmq versions, because they get updated between 14.5.0 and 14.7.0.

sphaero commented 7 years ago

weird, I have no windows machines for testing myself. There have been some issues in libzmq recently which are fixed in master but I don't recall any windows issues. But if Pyre is working fine it must be something in pyZOCP

fieldOfView commented 7 years ago

Some observations after some testing and sleuthing:

The most fundamental difference between how the chat example in pyre and pyzocp work is that the chat example uses zhelper.zthread_fork() to create a pipe, and pyzocp uses zhelper.zcreate_pipe(). The created inbox never seems to receive any messages on Windows.

Interestingly, the pyZOCP tests all pass. This is getting weirder the more I look into it.