Skip to content

net.Write doesn't handle timeouts in partial writes #2460

Closed

Description

@gopherbot

by sebastien.paolacci:

What steps will reproduce the problem?
1. Set a small, but large enough for sending few bytes, write timeout.
2. Send a large buffer that can't be sent in one single pass.
3. Make client's receive loop fast enough to respect timeout, but not to respect (number
of chunks x timeout).

What is the expected output?
Full buffer sent, no timeout.

What do you see instead?
Timeout.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux/amd64

Which revision are you using?  (hg identify)
r60.3,tip

Please provide any additional information below.

Current Write implementation handles partial writes, which make it really suitable for
turn-key high level calls like io.Copy{N}, but considers timeout as being a global
deadline whatever the amount of data being transferred.

Should applications have to deal with significantly heterogeneous transfer sizes,
timeout setting must be adjusted on a per call basis to reflect the more usual "min
bandwidth / max inactivity" concept.

Receiving large chunks takes longer than small ones but this doesn't provides with any
additional information regarding peer's status/health which timeouts are (mostly) useful
for.

There's a golang-nuts thread dedicated to that issue, Russ was hesitating between
deleting the timeout support and making the timeout reset on each byte sent, let's hope
the later is going to win;)
http://groups.google.com/group/golang-nuts/browse_thread/thread/500f3b0e9eed3811/

Activity

  1. rsc commented on Nov 14, 2011

    @rsc
    Contributor

    Comment 1:

    The timeout stuff needs to be rethought.

    Status changed to Accepted.

  2. gopherbot commented on Nov 15, 2011

    @gopherbot
    ContributorAuthor

    Comment 2 by sebastien.paolacci:

    Loosely linked with https://golang.org/issue/2458
  3. rsc commented on Dec 9, 2011

    @rsc
    Contributor

    Comment 3:

    Labels changed: added priority-later.

  4. rsc commented on Dec 12, 2011

    @rsc
    Contributor

    Comment 4:

    Labels changed: added priority-go1.

  5. robpike commented on Jan 13, 2012

    @robpike
    Contributor

    Comment 5:

    Owner changed to builder@golang.org.

  6. bradfitz commented on Jan 19, 2012

    @bradfitz
    Contributor

    Comment 6:

    Fixed by http://code.google.com/p/go/source/detail?r=15a4e4a

    Owner changed to @bradfitz.

    Status changed to Fixed.

  7. added this to the Go1 milestone on Apr 10, 2015
  8. locked and limited conversation to collaborators on Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions