Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

unix: Fix canceling request if it's the only one #669

wants to merge 1 commit into


None yet
2 participants

saghul commented Dec 26, 2012

This is a fix for the following case (which I surprisingly run into): there is a single request in the thread pool (say a getaddrinfo) and it's cancelled before it gets a chance to run. If no other request is put in the thread pool, the work_async will not be sent and thus the done callback will never be called. The fix consists in sending the async in case the cancelled request is the last request.

I don't know if a reliable test case can be written for this, though :-S

/cc @bnoordhuis


bnoordhuis commented Dec 28, 2012

@saghul Can you test 5ae28c2? Quoting the commit log:

Wake up the event loop with uv_async_send() when a request is cancelled.
Ensures the done_cb is run on the next tick of the event loop.

Not sending a wakeup signal results in the done_cb not getting called until
another request completes, which may be a long time coming when it's the only
request in the queue or when other requests are executing long-running jobs.

saghul commented Dec 28, 2012

@bnoordhuis that works :-)


bnoordhuis commented Dec 28, 2012

Thanks for testing, landed in 92a19a1.

@saghul saghul deleted the unknown repository branch Sep 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment