read_exact_cancellation_safe uses a loop to read from the socket, but doesn't account for the case where socket.read returns Ok(0) (indicating the other end has closed the socket).
This is readily apparent in the provided server.rs IPC example with the following client code
h: hopen`:unix://7000:user:password
hclose h
After the handle is closed the rust server immediately pins a core, and flamegraph shows the majority of samples in kdbplus::ipc::connection::read_exact_cancellation_safe::{{closure}}
Also confirmed same behaviour with TCP socket, haven't checked TLS.
Didn't raise a PR as haven't read much of the codebase, but write_all_cancellation_safe probably has the same problem as its sibling.
read_exact_cancellation_safeuses a loop to read from the socket, but doesn't account for the case wheresocket.readreturnsOk(0)(indicating the other end has closed the socket).This is readily apparent in the provided
server.rsIPC example with the following client codeAfter the handle is closed the rust server immediately pins a core, and flamegraph shows the majority of samples in
kdbplus::ipc::connection::read_exact_cancellation_safe::{{closure}}Also confirmed same behaviour with TCP socket, haven't checked TLS.
Didn't raise a PR as haven't read much of the codebase, but
write_all_cancellation_safeprobably has the same problem as its sibling.