Skip to content

EBADF in accept() handler if TCPServer.stop() was called in the meantime #2069

@pitrou

Description

@pitrou

We've had sporadic issues where a EBADF error when calling accept() was being logged. See example here:
https://travis-ci.org/dask/distributed/jobs/238031120#L1596-L1607

After some debugging, I've come to the conclusion that this happens whenever a IO handler calls TCPServer.stop(), while another handler is pending for a connection request on that TCPServer's listening socket(s). TCPServer.stop() closes the listening socket immediately and, when the queued accept handler is called, it finds a closed socket fd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions