From 8e4b248ca6cf66367476624899442974d17092f0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 5 Jun 2013 15:01:34 +0200 Subject: [PATCH] unix: unconditionally stop handle on close Make sure the handle is fully stopped by the time uv__stream_close() calls uv_read_stop(). Fixes the following assertion: Assertion failed: (!uv__io_active(&stream->io_watcher, UV__POLLOUT) || !ngx_queue_empty(&stream->write_completed_queue) || !ngx_queue_empty(&stream->write_queue) || stream->shutdown_req != NULL || stream->connect_req != NULL), function uv_read_stop, file ../deps/uv/src/unix/stream.c, line 1329. Fixes joyent/node#5622. --- src/unix/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/unix/stream.c b/src/unix/stream.c index 52972d9c..ad70eada 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -1395,8 +1395,9 @@ void uv__stream_close(uv_stream_t* handle) { } #endif /* defined(__APPLE__) */ - uv_read_stop(handle); uv__io_close(handle->loop, &handle->io_watcher); + uv_read_stop(handle); + uv__handle_stop(handle); close(handle->io_watcher.fd); handle->io_watcher.fd = -1;