Skip to content

read_exact_cancellation_safe causes an infinite loop after socket closed #12

Description

@CaitanyaDurley

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions