Skip to content

Commit

Permalink
libutil/ev_zmq: handle EV_ERROR on io watcher
Browse files Browse the repository at this point in the history
Problem: ev_zmq ignores events on its internal io watcher,
so when libev raises EV_ERROR on it because something went wrong
internally, nothing happens.

The internal io watcher is only used for its side effect of
unblocking the reactor when pollevents edge triggers from
"no events" to "some events".  The prep/check/idle watchers
do the heavy lifting.

Add a check for pending EV_ERROR events on the io watcher in
the check callback.  If found, notify the user via the ev_zmq
watcher callback.

This tracks a similar change in libflux/ev_flux.c, based on
experience with an internal failure documented in #2554.
  • Loading branch information
garlick committed Dec 2, 2019
1 parent 36db64f commit da7ebab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common/libutil/ev_zmq.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ static void check_cb (struct ev_loop *loop, ev_check *w, int revents)

if (handle == NULL)
zw->cb (loop, zw, EV_ERROR);
else if (ev_is_pending (&zw->io_w)
&& ev_clear_pending (loop, &zw->io_w) & EV_ERROR)
zw->cb (loop, zw, EV_ERROR);
else if (zmq_getsockopt (handle, ZMQ_EVENTS, &zevents, &zevents_size) < 0)
zw->cb (loop, zw, EV_ERROR);
else if ((revents = ztoe (zevents) & zw->events))
Expand Down

0 comments on commit da7ebab

Please sign in to comment.