z25 / pyZOCP

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

subscribing to a nonexisting receiver #74

Open sphaero opened 9 years ago

sphaero commented 9 years ago

Was just debugging this... apparently ZOCP just exits silently when you try to subscribe a signal

ie: I was trying:

self.signal_subscribe(self.uuid(), "painter1", peer, "imgId")

However the "painter1" receiver was spelled wrong resulting in a:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/home/people/arnaud/src/CreativeConcur/zcanvas_t.py", line 99, in run
    self._post_update()
  File "/home/people/arnaud/src/CreativeConcur/zcanvas_t.py", line 78, in _post_update
    self.emit_signal("imgId", id(self._img))
  File "/home/people/arnaud/src/pyZOCP/src/zocp.py", line 416, in emit_signal
    self.whisper(subscriber, msg.encode('utf-8'))
  File "/home/people/arnaud/src/pyre/pyre/pyre.py", line 170, in whisper
    self.actor.send_unicode("WHISPER", flags=zmq.SNDMORE)
  File "/home/people/arnaud/src/pyre/pyre/zactor.py", line 82, in send_unicode
    return self.pipe.send_unicode(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/zmq/sugar/socket.py", line 365, in send_string
    return self.send(u.encode(encoding), flags=flags, copy=copy)
  File "zmq/backend/cython/socket.pyx", line 581, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5447)
  File "zmq/backend/cython/socket.pyx", line 618, in zmq.backend.cython.socket.Socket.send (zmq/backend/cython/socket.c:5131)
  File "zmq/backend/cython/socket.pyx", line 96, in zmq.backend.cython.socket._check_closed (zmq/backend/cython/socket.c:1310)
zmq.error.ZMQError: Socket operation on non-socket

Which is a very weird exit.

It is gone when using the right spelling "Painter1" Still need to hunt this down but I guess we need to check for existence before sending the subscribe message.

sphaero commented 9 years ago

Adding to this it seems I can't subscribe a remote receiver to my emitter:

self.signal_subscribe(self.uuid(), "Painter1", peer, "imgId")
self.signal_subscribe(peer, "rmId", self.uuid(), "id1")

First one works second one doesn't

sphaero commented 9 years ago

Makes sense as whispering to yourself doesn't work so the subscription request is never send: https://github.com/z25/pyZOCP/blob/master/src/zocp.py#L400 Then fixing that the forwarding of third party request is the wrong way around

see the definition of: https://github.com/z25/pyZOCP/blob/master/src/zocp.py#L332 and then it's usage at: https://github.com/z25/pyZOCP/blob/master/src/zocp.py#L660

difficult to catch!