[zeromq-dev] EFSM not always raised in 2.1.8

MinRK benjaminrk at gmail.com
Sat Jul 30 20:34:42 CEST 2011


On Sat, Jul 30, 2011 at 08:31, Pieter Hintjens <ph at imatix.com> wrote:
> MinRK,
>
> OK, I've found the problem, I think.
>
> Issue is logged here: https://zeromq.jira.com/browse/LIBZMQ-236
>
> When I backported the changes for issue 231 some error handling on
> zmq_send() and zmq_recv() disappeared.
>
> The test case works properly now.
>
> Martin, can you review the attached patch?
>
> MinRK, the patched 2.1 master should now work, would you test that?

Thanks, it does appear to be fixed now.  I don't imagine it should be
a critical issue, since
it requires that your application have a broken send/recv pattern,
that is called more than once.  It only came up because
pyzmq's test suite has some checks for graceful error handling, so it
makes a bunch of
invalid calls.

-MinRK

> I'll make a 2.1.9 release if this proves to be a critical issue.
>
> Cheers
> Pieter
>
>
>
> diff --git a/src/socket_base.cpp b/src/socket_base.cpp
> index 10a4122..2167b0b 100644
> --- a/src/socket_base.cpp
> +++ b/src/socket_base.cpp
> @@ -492,6 +492,8 @@ int zmq::socket_base_t::send (::zmq_msg_t *msg_, int flags_)
>     rc = xsend (msg_, flags_);
>     if (rc == 0)
>         return 0;
> +    if (unlikely (errno != EAGAIN))
> +        return -1;
>
>     //  In case of non-blocking send we'll simply propagate
>     //  the error - including EAGAIN - upwards.
> @@ -541,6 +543,8 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
>
>     //  Get the message.
>     int rc = xrecv (msg_, flags_);
> +    if (unlikely (rc != 0 && errno != EAGAIN))
> +        return -1;
>     int err = errno;
>
>     //  Once every inbound_poll_rate messages check for signals and process
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list