[zeromq-dev] zmq "bug"
Matus Hamorsky
mhamorsky at gmail.com
Mon Dec 22 12:18:33 CET 2008
Hi there,
I encountered this problem with zmq: (have pyton2.6, zmq is from trunk, rev 812)
zmq_server &
./q_test.py
./q_send.py Q_TEST hello
-- q_test prints 'hello'
killall zmq_server
./q_send.py Q_TEST hello
-- q_test IS STILL RUNNING but prints nothing
-- I start zmq_server again
zmq_server &
-- Ctrl-C to q_test.py does nothing. I try to terminate it with an
'EXIT' message
./q_send.py Q_TEST EXIT
~/zmq/report|0|$ ./qsend.py Q_TEST EXIT
python2.6: api_thread.cpp:151: void zmq::api_thread_t::bind(const
char*, const char*, zmq::i_thread*, zmq::i_thread*): Assertion `false'
failed.
Aborted
THE BUG: q_test.py is now hanging. no new q_test.py can be launched
b/c the port is in use:
~/zmq/report|0|$ ./q_test.py
Address already in use
rc == 0 (tcp_listener.cpp:125)
Aborted
regards,
M.
-------------------------
q_send.py
#! /usr/bin/env python2.6
import pyzmq
import time
import sys
if len (sys.argv) < 3:
print 'qsend QUEUE message'
else:
z = pyzmq.ZMQ (hostname = 'localhost')
eid = z.create_exchange ('ELL')
z.bind ('ELL', sys.argv[1])
z.send (eid, sys.argv[2])
time.sleep(1)
-------------------------
q_test.py
#!/usr/bin/env python2.6
import pyzmq
def main():
z = pyzmq.ZMQ (hostname = 'localhost')
z.create_queue ('Q_TEST', pyzmq.SCOPE_GLOBAL, '0.0.0.0:10101')
z.ignore_connection_errors (True)
while True:
qid, m = z.receive (block=True)
if m in ['EXIT', 'QUIT']:
break
print 'received', m
if __name__ == "__main__":
main()
ignore_connection_errors set the global variable g_eh:
static int g_eh = false;
static bool pyZMQ_error_handler (char const* name)
{
return g_eh;
}
this function is used as:
zmq::set_error_handler (pyZMQ_error_handler);
More information about the zeromq-dev
mailing list