Closing a pending 'uv_signal_t' never completes

40 views
Skip to first unread message

Renato Maia

unread,
Jul 28, 2019, 10:44:50 AM7/28/19
to li...@googlegroups.com
I just noticed that using libuv 1.30.2 built in Ubuntu 16.04, if I call 'uv_close' on a 'uv_signal_t' which callback is going to be executed in the same loop iteration, the callback of this 'uv_close' is never executed, no matter how many times I call `uv_run`, even though it is 'uv_is_closing'.

The attached code illustrates the problem by writing 'uv_pipe_t' with the read end closed to cause a SIGPIPE. In the write callback I close the 'uv_pipe_t' and a `uv_signal_t' previously started with SIGPIPE. The 'uv_pipe_t' closes, but the 'uv_signal_t' never does.

I also noticed that if I close any other handler after 'uv_run' returns, then the 'uv_close' callback of the 'uv_signal_t' is called the next time I call 'uv_run'.

Does any one knows what I might be doing wrong in this code, or a workaround for this problem?

--
Renato Maia
signalclose.c

Ben Noordhuis

unread,
Jul 29, 2019, 6:39:39 AM7/29/19
to li...@googlegroups.com
I think you found a bug. Can you open a GitHub issue?

What happens is that uv_close() postpones closing the uv_signal_t
until the event loop has had time to process the events coming from
the signal handler.

For some reason that doesn't happen with your test case. The internal
I/O watcher it's waiting for never fires.

Renato Maia

unread,
Jul 29, 2019, 8:30:07 PM7/29/19
to li...@googlegroups.com
On Mon, Jul 29, 2019 at 7:39 AM Ben Noordhuis <in...@bnoordhuis.nl> wrote:
I think you found a bug.

Thanks for the info.
 
Can you open a GitHub issue?
Reply all
Reply to author
Forward
0 new messages