Exception thrown during poll
Closed this issue · 5 comments
I have a REQ-REP socket pair and when I sent a message from REQ to REP, the REP side would throw a "Operation cannot be accomplished in current state" exception. It seems as though something was trying to receive the message twice.
I thought I had fixed the problem by moving the 2 lines around nzmqt.cpp:646 from the run()
method into the bottom of the poll()
method:
if (!m_stopped)
QTimer::singleShot(m_interval, this, SLOT(run()));
A little more testing revealed that this did not fix the problem. Also, manually setting the polling interval to 500ms or even 1 second did not improve things. To complicate matters further, this same code all works great on a different machine (with a different version of CentOS and more CPUs, but same ZeroMQ and nzmqt).
I believe it's timing-related. Sticking a bunch of qDebug()s into poll() prevented the exception in the REP socket code, but then the REQ started having exceptions.
UPDATE: After running through gdb a bit, I found that hasMoreMessageParts()
was returning true when it shouldn't. I noticed in the docs for zmq_getsockopt
that the data type used for ZMQ_RCVMORE
is int
. I changed the type from quint64
to int
and all seems to be well.
Hi Dave,
thank you very much for your feedback and information on how to fix that issue. Would it be possible to provide your fix as a patch against the master branch? Either by a diff or by a fork on github, where I can pull from?
Thanks again,
Jonny
Sure thing, the pull request has been sent.
On Fri, Sep 28, 2012 at 3:03 AM, Jonny Dee notifications@github.com wrote:
Hi Dave,
thank you very much for your feedback and information on how to fix that
issue. Would it be possible to provide your fix as a patch against the
master branch? Either by a diff or by a fork on github, where I can pull
from?Thanks again,
Jonny—
Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-8966304.
Thanx for your fix, I've just merged it. But after I did that I checked ZMQ's documentation and I cannot confirm the integer type is int32_t. As far as I can tell from the docs it is indeed int64_t. See here: http://api.zeromq.org/2-2:zmq-getsockopt
Where did you get your info from?
Regards,
Jonny
Ahh, that must be something that changed between 2.2 and 3.2. I'm using ZMQ
3.2, and its manpage says the type is int (same info is here also:
http://api.zeromq.org/3-2:zmq-getsockopt). I needed to change a bunch of
constants to get nzmqt compiling for 3.2, but other than that it seems to
be fine.
On Sat, Sep 29, 2012 at 11:28 AM, Jonny Dee notifications@github.comwrote:
Thanx for your fix, I've just merged it. But after I did that I checked
ZMQ's documentation and I cannot confirm the integer type is int32_t. As
far as I can tell from the docs it is indeed int64_t. See here:
http://api.zeromq.org/2-2:zmq-getsockoptWhere did you get your info from?
Regards,
Jonny—
Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-9005015.
I've created branch 'branch-2.x' for nzmqt code compatible with ZeroMQ 2.2. The master branch now contains your fix and compiles with ZeroMQ 3.2 and the C++ binding https://github.com/zeromq/cppzmq. The examples provided with nzmqt still work. If you have got any further changes that make the code in 'master' more compatible with ZeroMQ 3.2+ I would appreciate your contributions :)