{"action":"closed","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/522","labels_url":"https://api.github.com/repos/libuv/libuv/issues/522/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/522/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/522/events","html_url":"https://github.com/libuv/libuv/issues/522","id":105937189,"number":522,"title":"`uv_write` `uv_close` status == `UV_ECANCELED` bug","user":{"login":"2ix","id":2523492,"avatar_url":"https://avatars.githubusercontent.com/u/2523492?v=3","gravatar_id":"","url":"https://api.github.com/users/2ix","html_url":"https://github.com/2ix","followers_url":"https://api.github.com/users/2ix/followers","following_url":"https://api.github.com/users/2ix/following{/other_user}","gists_url":"https://api.github.com/users/2ix/gists{/gist_id}","starred_url":"https://api.github.com/users/2ix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2ix/subscriptions","organizations_url":"https://api.github.com/users/2ix/orgs","repos_url":"https://api.github.com/users/2ix/repos","events_url":"https://api.github.com/users/2ix/events{/privacy}","received_events_url":"https://api.github.com/users/2ix/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-09-11T03:16:40Z","updated_at":"2015-09-11T08:12:50Z","closed_at":"2015-09-11T08:12:50Z","body":"https://github.com/libuv/libuv/blob/v1.x/test/test-tcp-close.c#L60\r\n\r\nIf you add an additional `ASSERT` test to this code:\r\n```\r\nstatic void write_cb(uv_write_t* req, int status) {\r\n  /* write callbacks should run before the close callback */\r\n  ASSERT(status == UV_ECANCELED);\r\n  ASSERT(close_cb_called == 0);\r\n  ASSERT(req->handle == (uv_stream_t*)&tcp_handle);\r\n  write_cb_called++;\r\n  free(req);\r\n}\r\n```\r\n\r\nThen the following error occurs:\r\n```\r\n=============================================================\r\n[%  22|+  61|-   0|T   0|S   1]: tcp_close\r\n`tcp_close` failed: exit code 134\r\nOutput from process `tcp_close`:\r\nAssertion failed in ../test/test-tcp-close.c on line 61: status == UV_ECANCELED\r\n=============================================================\r\n```\r\n\r\nThis is causing issues with an application we are developing with libuv where we are calling `uv_close` on two connections where one connection may have already called `uv_write` before it's callback is called and even though we are trying to handle `UV_ECANCELED` it appears libuv no longer supports \"In-progress requests, like uv_connect_t or uv_write_t, are cancelled and have their callbacks called asynchronously with status=UV_ECANCELED.\"\r\n\r\nWas this feature removed for `uv_write_t` or perhaps with the test not being present, was overlooked? Any chance we could please have `UV_ECANCELED` added in for `uv_write_t` callbacks when their tcp handle is `uv_close`.\r\n"}}