Re: [zeromq-dev] zloop.c: timer event cannot break out of zloop

2013-01-13 Thread Pieter Hintjens
I've fixed this, I think, see: https://github.com/zeromq/czmq/pull/112

Now waiting for one of the CZMQ maintainers to merge it.

-Pieter

On Fri, Jan 11, 2013 at 8:46 AM, Gundry, Samuel (TI)
samuel.gun...@riotinto.com wrote:
 Hi,

 In zloop, a timer return code rc may be overwritten by poller return codes. 
  rc is set at line 372 but is then overwritten at line 414. 
 https://github.com/zeromq/czmq/blob/master/src/zloop.c#L372

 I'm not sure of the correct behaviour hence why I haven't submitted a patch.

 Should the pollers be called if a timer returns -1 in the same loop?
 If not, then don't loop over the pollers when rc != -1?

 Regards,
 Sam
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] problem using last endpoint sockopt in pyzmq

2013-01-13 Thread MinRK
On Sat, Jan 12, 2013 at 3:33 PM, Chris Laws clawsi...@gmail.com wrote:

 Hi,

 I am trying to use a wildcard port in an effort to let the OS assign an
 ephemeral port. I then try to ascertain the actual endpoint by using the
 LAST_ENDPOINT socket option so that I can inform other apps of the real
 endpoint.

 This is along the lines of the suggestion here:
 http://lists.zeromq.org/pipermail/zeromq-dev/2012-October/018915.html

 A simple script which demonstrates the problem is located in this gist:
 https://gist.github.com/4520939

 The output I get when I run the script:

 Python version: 2.7.2 (default, Jun 20 2012, 16:23:33)  [GCC 4.2.1
 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
 zmq version: 3.2.2
 pyzmq version: 2.2dev
 Endpoint is tcp://192.168.1.2:*
 Traceback (most recent call last):
   File zmq_test.py, line 38, in module
 router.getsockopt(zmq.LAST_ENDPOINT)
   File socket.pyx, line 394, in zmq.core.socket.Socket.getsockopt
 (zmq/core/socket.c:3915)
 zmq.core.error.ZMQError: Invalid argument

 zmq.LAST_ENDPOINT is an option listed in the constants module.

 Am I doing something wrong? Is there a better way to find the actual
 endpoint used when providing a wildcard port in the endpoint string to bind?


Running your script, I get:

Python version: 2.7.2 (default, Jun 20 2012, 16:23:33)  [GCC 4.2.1
Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
zmq version: 3.2.2
pyzmq version: 2.2dev
Endpoint is tcp://192.168.1.193:*

So my guess is you just need to recompile pyzmq, and/or make sure it's up
to date.
Also, it looks like ZMQ_LAST_ENDPOINT doesn't actually do what you want it
to.
Perhaps this should be considered a libzmq bug?




 I am aware that pyzmq has the bind_to_random_port function but that does
 not really fit my need exactly as that could potentially block for some
 extended period of time.

In most cases it would likely be very short but I am trying to integrate
 ZMQ and Twisted together so I am trying to implement a solution that avoids
 blocking where ever possible.


How long do you think bind_to_random_port can block?  1ms would be an
unusually long time for that method to take (I've never seen it happen).
I would just use bind_to_random_port, rather than trying to fix a problem
that probably won't come up.

Two reasons:

1. bind will not take more than 1ms unless there are other, much more
severe performance issues going on
2. bind is a relatively rare call, so even if it were slow it generally
doesn't matter

-MinRK




 Regards,
 Chris








 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Assertion failed: fd_table [handle_].valid in context.close()

2013-01-13 Thread Jonathan Wood

On 12/01/2013, at 4:30 PM, Ian Barber ian.bar...@gmail.com wrote:

 
 
 On Wed, Jan 9, 2013 at 5:38 PM, Jonathan Wood jonathan.w...@nominum.com 
 wrote:
 I am seeing an assertion failure when shutting down my application:
 
 Assertion failed: fd_table [handle_].valid (devpoll.cpp:91)
 
 Looks like it could be a bug to in the lib to me - could you file an issue 
 with what you have here over at https://zeromq.jira.com
 

Done - https://zeromq.jira.com/browse/LIBZMQ-495.


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev