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

syscall: Windows Errno.Temporary and Errno.Timeout are incomplete #15637

Open
eahydra opened this issue May 11, 2016 · 6 comments
Open

syscall: Windows Errno.Temporary and Errno.Timeout are incomplete #15637

eahydra opened this issue May 11, 2016 · 6 comments
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. ExpertNeeded help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@eahydra
Copy link

eahydra commented May 11, 2016

What version of Go are you using (go version)?
go version go1.6 windows/amd64

I read src/syscall/syscall_windows.go and find Errno.Temporary() just check EINTR, EMFILE and Errno.Timeout, but the src/syscall/syscall_unix.go, Errno.Temporary() additional check ECONNRESET and ECONNABORTED.

so why different between windows and linux?

Sorry my poor English.

@eahydra eahydra changed the title net: net.OpError.Temporary different between windows and linux. syscall: syscall.Errno different between windows and linux. May 11, 2016
@bradfitz bradfitz added this to the Go1.8Maybe milestone May 11, 2016
@alexbrainman
Copy link
Member

why different between windows and linux?

Originally Go had linux and darwain, but no support for windows. So when adding windows, we had to define all unix constants like EINTR and EMFILE, because os package used to use them. Otherwise os package wouldn't build.

But Windows syscalls do not really return EINTR or EMFILE or ECONNRESET or ECONNABORTED.

When time came to implement net package, windows version was very much separate code. So net package does not use ECONNRESET or ECONNABORTED.

I just checked our current source:

# cd $GOROOT
# grep syscall.ECONNRESET * -r
# grep syscall.ECONNABORTED * -r
src/net/fd_unix.go:                     case syscall.ECONNABORTED:
src/net/error_unix_test.go:     abortedConnRequestErrors = []error{syscall.ECONNABORTED} // see accept in fd_unix.go
#

No windows code uses ECONNRESET or ECONNABORTED.

Alex

@eahydra
Copy link
Author

eahydra commented May 12, 2016

Yes. windows WIN32 API do not really return ECONNRESET,just return such as WSAECONNRESET.
Hmm, I don't known whether if it is a bug. When I want to check net.OpError to determine CONNREST like this: https://play.golang.org/p/hnxswTG_Sl (forgive me.. I also want to markdown to paste the code, but the format....)

So, Is the way right? Or is there another way to do this?

@alexbrainman
Copy link
Member

So, Is the way right? Or is there another way to do this?

I don't know. I will let @mikioh and @bradfitz answer this.

Alex

@quentinmit quentinmit added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 10, 2016
@rsc
Copy link
Contributor

rsc commented Oct 21, 2016

Basically none of the actual temporary/timeout errors are checked by Errno.Temporary and Errno.Timeout. Like you said, all the WSA* forms are missing to start. I am not sure how to enumerate all the ones that should match, though. There are many more error codes on Windows than on Unix.

@rsc rsc changed the title syscall: syscall.Errno different between windows and linux. syscall: Windows Errno.Temporary and Errno.Timeout are wrong Oct 21, 2016
@rsc rsc changed the title syscall: Windows Errno.Temporary and Errno.Timeout are wrong syscall: Windows Errno.Temporary and Errno.Timeout are incomplete Oct 21, 2016
@rsc rsc modified the milestones: Go1.9Early, Go1.8Maybe Nov 2, 2016
@bradfitz bradfitz modified the milestones: Go1.10Early, Go1.9Early May 3, 2017
@bradfitz bradfitz added early-in-cycle A change that should be done early in the 3 month dev cycle. and removed early-in-cycle A change that should be done early in the 3 month dev cycle. labels Jun 14, 2017
@bradfitz bradfitz modified the milestones: Go1.10Early, Go1.10 Jun 14, 2017
@bradfitz bradfitz modified the milestones: Go1.10, Unplanned Dec 7, 2017
@MaxSem
Copy link

MaxSem commented Feb 20, 2019

After 7f6105f, there's no more discrepancy between Unix and Windows. Is adding Windows-specific error codes still desireable?

@gopherbot
Copy link

Change https://golang.org/cl/208537 mentions this issue: syscall: add relevant ErrNo for Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
early-in-cycle A change that should be done early in the 3 month dev cycle. ExpertNeeded help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

7 participants