Skip to content

Calling close on a UnixSocket with a pending read waits for the read to time out on Linux #60

@charleskorn

Description

@charleskorn

If you create a UnixSocket, set a read timeout and then:

  • call read() on one thread
  • wait a bit and then call close() on another thread

...the behaviour is different on OS X and Linux.

On OS X, the read is cancelled as soon as close() is called and so close() returns immediately. On Linux, the read blocks until the read timeout is reached, and then close() returns.

This makes interrupting read operations impossible, and is the root cause of square/okhttp#4233.

I have created a test case that fails on Linux (but passes on OS X) in charleskorn@b0981ae.

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