aboutsummaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2020-12-28 17:51:23 +0100
committerGitHub <noreply@github.com>2020-12-28 11:51:23 -0500
commitc9406ba0e3d67907c1973a71968b89a6bd83c63c (patch)
tree8d2350ff796769642c76bb845ab0cb2319029d3d /docs/src
parenta779fccfd19f8c5baa6856f96abe42a39581e7ae (diff)
downloadlibuv-c9406ba0e3d67907c1973a71968b89a6bd83c63c.tar.gz
libuv-c9406ba0e3d67907c1973a71968b89a6bd83c63c.zip
poll,unix: ensure safety of rapid fd reuse
Consider the following scenario: uv_poll_init(loop, poll, fd); uv_poll_start(poll, UV_READABLE, cb); // the cb gets invoked etc. uv_poll_stop(poll); close(fd); fd = allocate_new_socket(); // allocate_new_socket() is assigned the same fd by "bad luck" from the OS // some time later: uv_poll_init(loop, otherpoll, fd); uv_poll_start(otherpoll, UV_READABLE, cb); uv_close(poll); // uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed. According to documentation, "however the fd can be safely closed immediately after a call to uv_poll_stop() or uv_close()." Though, in this scenario, we close()'d our file descriptor, and by bad luck we got the same file descriptor again and register a new handle for it and start polling. Previously that would lead to an assertion failure, if we were to properly free the original handle via uv_close(). This commit fixes that by moving the check whether a only a single poll handle is active to uv_poll_start() instead of the stopping routines. Fixes: https://github.com/libuv/libuv/issues/1172 Fixes: https://github.com/bwoebi/php-uv/issues/81 Fixes: https://github.com/b2wdigital/aiologger/issues/82 Fixes: https://github.com/invenia/LibPQ.jl/issues/140 PR-URL: https://github.com/libuv/libuv/pull/2686 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Diffstat (limited to 'docs/src')
0 files changed, 0 insertions, 0 deletions