Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: DialTimeout return "io timeout" when the timeout argument is large #14431

prashantv opened this issue Feb 20, 2016 · 1 comment


None yet
3 participants
Copy link

commented Feb 20, 2016

This issue occurs with the latest Go version (1.6 darwin/amd64) and on master.

When net.DialTimeout is passed a very large timeout argument like 1 << 63 - 1, the call returns immediately with the error i/o timeout. I expected the call to block indefinitely.

I have a repro test:

The issue seems to be in runtime.setDeadlineImpl:

d := runtimeNano() + int64(t.Sub(time.Now()))

This can overflow the int64 and result in a negative number. I'm also not sure whether this line needs to call runtimeNano and time.Now. The current code converts t to an int64 representing the unix nanos, but this can be done by calling t.UnixNano which will be clearer and cheaper.

I'm working on a CL to fix this.


This comment has been minimized.

Copy link

commented Feb 20, 2016

CL mentions this issue.

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Feb 21, 2016

@gopherbot gopherbot closed this in c4cb365 Feb 23, 2016

@golang golang locked and limited conversation to collaborators Feb 28, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.