Renato Maia
unread,Jun 25, 2021, 8:09:42 PM6/25/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to li...@googlegroups.com
In libuv v1.x (963ecc82) in Windows 10, I noticed that if I
'uv_shutdown' a 'uv_pipe_t' being read, it will cause its 'uv_read_cb'
to be called, and without calling 'uv_alloc_cb' first. Is this
expected?
I was surprised because it is not what happens in Linux, nor in
Windows if we use a 'uv_tcp_t' instead of a `uv_pipe`, which keeps
being read even after shutdown, as stated in the docs: "Shutdown the
outgoing (write) side of a duplex stream."
Finally, my code didn't expect to have 'uv_read_cb' called without
first calling the 'uv_alloc_cb', even though it will just report an
error (UV_EOF?) and therefore the buffer allocation is not necessary.
Since this seems to only happen in very rare cases
(win32+pipe+shutdown) I just wanted to check here if it was actually
expected.
I attached a small example to reproduce this scenario The output for
Linux is below, and only the server reading side is ended:
```
libuv_pipeshutdown.c:91:main(err >= 0)
libuv_pipeshutdown.c:94:main(err >= 0)
libuv_pipeshutdown.c:97:main(err >= 0)
libuv_pipeshutdown.c:99:main(err >= 0)
libuv_pipeshutdown.c:103:main(err >= 0)
libuv_pipeshutdown.c:32:on_server_accept(server_stream)
libuv_pipeshutdown.c:33:on_server_accept(err >= 0)
libuv_pipeshutdown.c:36:on_server_accept(err >= 0)
libuv_pipeshutdown.c:39:on_server_accept(err >= 0)
libuv_pipeshutdown.c:41:on_server_accept(err >= 0)
libuv_pipeshutdown.c:69:on_client_connect(shutdown_req)
libuv_pipeshutdown.c:70:on_client_connect(err >= 0)
libuv_pipeshutdown.c:72:on_client_connect(err >= 0)
libuv_pipeshutdown.c:60:on_client_shutdown(err >= 0)
libuv_pipeshutdown.c:62:on_client_shutdown(err >= 0)
libuv_pipeshutdown.c:22:on_server_alloc(handle->data == NULL)
libuv_pipeshutdown.c:15:on_server_read(stream->data == server_buffer)
libuv_pipeshutdown.c:17:on_server_read(nread == UV_EOF)
```
The ouput on Windows 10 is:
```
libuv_pipeshutdown.c:91:main(err >= 0)
libuv_pipeshutdown.c:94:main(err >= 0)
libuv_pipeshutdown.c:97:main(err >= 0)
libuv_pipeshutdown.c:99:main(err >= 0)
libuv_pipeshutdown.c:103:main(err >= 0)
libuv_pipeshutdown.c:69:on_client_connect(shutdown_req)
libuv_pipeshutdown.c:70:on_client_connect(err >= 0)
libuv_pipeshutdown.c:72:on_client_connect(err >= 0)
libuv_pipeshutdown.c:32:on_server_accept(server_stream)
libuv_pipeshutdown.c:33:on_server_accept(err >= 0)
libuv_pipeshutdown.c:36:on_server_accept(err >= 0)
libuv_pipeshutdown.c:39:on_server_accept(err >= 0)
libuv_pipeshutdown.c:41:on_server_accept(err >= 0)
libuv_pipeshutdown.c:60:on_client_shutdown(err >= 0)
libuv_pipeshutdown.c:62:on_client_shutdown(err >= 0)
libuv_pipeshutdown.c:46:on_client_read(stream->data == client_buffer)
Assertion failed: stream->data == client_buffer, file
libuv_pipeshutdown.c, line 46
```
Thanks in advance.
--
Renato Maia