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 · 5 comments

Comments

@eahydra
Copy link

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

@bradfitz bradfitz added the OS-Windows label May 11, 2016

@alexbrainman

This comment has been minimized.

Copy link
Member

commented May 12, 2016

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

commented May 12, 2016

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

@rsc

This comment has been minimized.

Copy link
Contributor

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 the help wanted label May 3, 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

This comment has been minimized.

Copy link

commented Feb 20, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.