Closed leiless closed 4 years ago
According to uv_pipe_connect(), it'll poll UV_HANDLE_READABLE | UV_HANDLE_WRITABLE
for given uv_pipe_t* handle
, in our case, it's ipc_client
:
err = 0;
if (new_sock) {
err = uv__stream_open((uv_stream_t*)handle,
uv__stream_fd(handle),
UV_HANDLE_READABLE | UV_HANDLE_WRITABLE);
}
if (err == 0)
uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
Later in our ipc_client_connect_cb(), we shouldn't poll the same fd(backed by ipc_client
) more than once?
https://github.com/libuv/libuv/pull/2686
Creating a second poll handle over the same fd is not supported. Currently we do give an error if the handle is running,...
https://github.com/libuv/libuv/issues/2387
Are you using 2 different poll handles for the same fd?
Hi,
libuv
maintainers, I recently wrote a demolibuv
program that usesuv_pipe_t
for the IPC echo test.In the demo program
The code can be found at gist.
When I run above code in Ubuntu 18.04 LTS, libuv(
1.18.0
) crashed:The core function
uv_poll_start
failed, which upcalled fromuv_util_poll_init_start()
:--
And then I run the code under Ubuntu 20.04 LTS, libuv
1.34.2
, everything works fine--
Is this phenomena indicates that it's a bug in old
libuv
implementation? Or I just simply misused thelibuv
APIs?