Skip to content

net: document net.Conn operation after deadline is exceeded #17982

Closed
@dsnet

Description

@dsnet

The current phrasing on net.Conn.SetDeadline is:

A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future and pending I/O, not just the immediately following call to Read or Write.

An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.

A zero value for t means I/O operations will not time out.

I'm debugging some non-compliant implementations of net.Conn due to the clarification made in (CL/30164). While fixing them, I noticed another discrepancy of some net.Conn implementations as compared to net.TCPConn and would like some clarification on expected behavior.

The net.TCPConn implementation allows a deadline to be exceeded, which unblocks any pending IO operations. However, after an timeout, it also allows the user to extend the deadline to be in the future, essentially allowing IO operations to function again.

In some of the implementations I'm fixing, once the deadline has been exceeded, the underlying connection is destroyed and it does not matter if the deadline is set to be in the future again; all IO operations henceforth are dead.

Is "refreshable" deadlines an expected behavior of net.Conn? Does any logic in the standard library depend on it?

/cc @bradfitz @ianlancetaylor

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions