[zeromq-dev] shutting down proxy device cleanly with pyzmq

Sideropoulos, Alexander alexander at thequery.net
Sat Oct 19 06:46:29 CEST 2013


13.1.0

I have attached an interactive session log which shows the issue as clearly
as possible. I might just be doing something dumb, though...

Thanks for looking into it.
--ap


On Wed, Oct 16, 2013 at 12:52 AM, MinRK <benjaminrk at gmail.com> wrote:

> What version of pyzmq? Can you provide a complete failing example?  I
> can't reproduce this in pyzmq master, so maybe I have fixed it since 13.0.
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131018/65047856/attachment.htm>
-------------- next part --------------
Python 3.3.1 (default, Apr 20 2013, 18:22:16)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.65))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import zmq
>>> zmq.pyzmq_version_info()
(13, 1, 0)
>>> zmq.zmq_version_info()
(3, 2, 2)
>>> ctx = zmq.Context.instance()
>>>
>>> s = ctx.socket(zmq.PUB) # socket to send via proxy
>>> s.bind('inproc://test')
>>>
>>> r = ctx.socket(zmq.SUB) # socket to recv via proxy
>>> r.setsockopt_string(zmq.SUBSCRIBE, '')
>>> r.connect('tcp://localhost:5555')
>>>
>>> p = zmq.devices.ThreadProxy(zmq.SUB, zmq.PUB)
>>> p.setsockopt_in(zmq.SUBSCRIBE, b'')
>>> p.connect_in('inproc://test')
>>> p.bind_out('tcp://*:5555')
>>> p.start()
>>>
>>> s.send_string('hello') # just some test messages
>>> r.recv_string()
'hello'
>>> s.send_string('world')
>>> r.recv_string()
'world'
>>>
>>> ctx.term() # now terminate the context and the proxy should exit...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.3.1/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 639, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python3/3.3.1/Frameworks/Python.framework/Versions/3.3/lib/python3.3/threading.py", line 596, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.3/site-packages/zmq/devices/proxydevice.py", line 84, in run
    rc = zmq.proxy(ins, outs, mons)
  File "_device.pyx", line 82, in zmq.core._device.proxy (zmq/core/_device.c:1325)
  File "checkrc.pxd", line 18, in zmq.core.checkrc._check_rc (zmq/core/_device.c:1517)
zmq.error.ContextTerminated: Context was terminated

^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "context.pyx", line 151, in zmq.core.context.Context.term (zmq/core/context.c:1774)
  File "checkrc.pxd", line 11, in zmq.core.checkrc._check_rc (zmq/core/context.c:2510)
KeyboardInterrupt
>>>


More information about the zeromq-dev mailing list