Looks good. Thanks for taking the time to make this patch. -Pieter
On Sun, Dec 27, 2015 at 12:00 AM, Steven Butner <[email protected]> wrote: > On 12/25/2015 3:00 AM, [email protected] wrote: >> Send zeromq-dev mailing list submissions to >> [email protected] >> >> To subscribe or unsubscribe via the World Wide Web, visit >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> or, via email, send a message with subject or body 'help' to >> [email protected] >> >> You can reach the person managing the list at >> [email protected] >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of zeromq-dev digest..." >> >> >> Today's Topics: >> >> 1. Re: possible bug in CZMQ's zloop_start .... with fix >> (Pieter Hintjens) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Thu, 24 Dec 2015 18:18:41 +0100 >> From: Pieter Hintjens <[email protected]> >> Subject: Re: [zeromq-dev] possible bug in CZMQ's zloop_start .... with >> fix >> To: ZeroMQ development list <[email protected]> >> Message-ID: >> <CADL5_sis3M=VnZY1gB=t4cWrtMQwbH=3wkfuwjhivafj-1a...@mail.gmail.com> >> Content-Type: text/plain; charset=UTF-8 >> >> Sounds familiar; be sure to retest on CZMQ master and see it's not >> been fixed there. If not, go ahead and send a pull request... :) >> >> On Wed, Dec 23, 2015 at 10:48 PM, Steven Butner <[email protected]> wrote: >>> I'm running CZMQ version 3.0.1 (though seemingly-identical code appears >>> to be present in the newer version also) on an Ubuntu-14.04 LTS system >>> running on x64 hardware. The zloop_start() routine does not terminate >>> when a ticket timer handler returns -1, yet the API description for CZMQ >>> 3.0.1 says that the zloop_start routine "returns 0 if interrupted, -1 if >>> canceled by a handler". >>> >>> Inspection of the source at zloop.c, line 780 shows that a return of -1 >>> from a ticket handler does indeed break out from the ticket-handling >>> while loop but because the return code (-1, in this case) is not stored >>> in "rc", the zloop_start() routine does not actually return. Instead, >>> on my system, it keeps polling. >>> >>> If I change the code at line 781 to be as below, then zloop_start() >>> returns when a ticket timer handler returns -1 and the behavior seems to >>> be as advertised in the API documentation. >>> >>> 775 // Handle any tickets that have now expired >>> 776 s_ticket_t *ticket = (s_ticket_t *) zlistx_first (self->tickets); >>> 777 while (ticket && time_now >= ticket->when) { >>> 778 if (self->verbose) >>> 779 zsys_debug ("zloop: call ticket handler"); >>> 780 if (ticket->handler (self, 0, ticket->arg) == -1) >>> 781 { rc = -1; break; } // Timer handler signaled break >>> 782 zlistx_delete (self->tickets, ticket->list_handle); >>> 783 ticket = (s_ticket_t *) zlistx_next (self->tickets); >>> 784 } >>> >>> Am I mis-understanding the intended behavior of zloop_start() in this >>> case or is this, in fact, a bug? >>> >>> Thanks .... >>> Steve Butner >>> >>> _______________________________________________ >>> zeromq-dev mailing list >>> [email protected] >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> >> ------------------------------ >> >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> >> >> End of zeromq-dev Digest, Vol 96, Issue 23 >> ****************************************** > Pieter: > > I have checked the version 3.0.2 master for CZMQ and found that it has > the same bug. Thus, per your suggestions in our previous email exchange > I have created issue #1278 and pull request #1279. > > This is my first time contributing a fix for a bug. I hope I did all of > the steps of the C4 process correctly. On my systems this change fixes > the problem. > > Steve Butner > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
