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: Dial() connection refused error is not syscall.ECONNREFUSED value on windows #45621

Closed
JamesDunne opened this issue Apr 18, 2021 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@JamesDunne
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.16 windows/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

https://play.golang.org/p/9jvY6yme07T

What did you expect to see?

Expected error value returned from net.Dial() to be a syscall.Errno value equal to syscall.ECONNREFUSED

What did you see instead?

error is a syscall.Errno value: 0x274d
dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
@seankhliao seankhliao changed the title windows: net.Dial() connection refused error is not syscall.ECONNREFUSED value net: Dial() connection refused error is not syscall.ECONNREFUSED value on windows Apr 18, 2021
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows labels Apr 18, 2021
@ianlancetaylor
Copy link
Contributor

The exact use of sysca.ECONNREFUSED is inherently system dependent. It doesn't work on all systems. In particular, as you've discovered, it doesn't work on Windows.

What are you really trying to do?

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 18, 2021
@JamesDunne
Copy link
Author

Ah very well then.

I'm just trying to suppress otherwise noisy error logging of attempts to connect to a service that is not guaranteed to be up. I worked around the problem on windows by comparing to the exact syscall.Errno value I discovered.

@golang golang locked and limited conversation to collaborators Apr 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants