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: Listener crashes on windows #46125

Closed
almartino opened this issue May 12, 2021 · 21 comments
Closed

net: Listener crashes on windows #46125

almartino opened this issue May 12, 2021 · 21 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@almartino
Copy link

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

$ go version
go version go1.15.12 windows/amd64

Does this issue reproduce with the latest release?

Yes, test done with:

  • 1.15.12
  • 1.16.3
  • 1.16.4

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\pc\AppData\Local\go-build
set GOENV=C:\Users\pc\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\pc\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\pc\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\pc\projects\XXXX\XXXX\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\pc\AppData\Local\Temp\go-build555747750=/tmp/go-build -gno-record-gcc-switches

What did you do?

The following program fails when launched directly in the IDE (Goland) and with go run main.go:

package main
​
import (
	"fmt"
	"log"
	"net"
	"runtime"
)
​
func main() {
	//handler := rest.RegisterRoutes()
	log.Println("starting server...")
	//if err := http.ListenAndServe("127.0.0.1:8081", handler); err != nil {
	//	log.Fatalf("could not listen and serve: %v", err)
	//}
	fmt.Println(runtime.GOOS)
	lis, err := net.Listen("tcp", "127.0.0.1:9080") // also tried with "tcp", ":9080"
	if err != nil {
		log.Fatal(err)
	}
	defer lis.Close()
	lis.Accept()
}

The same program is ok when launched in debug directly in the IDE(Goland)

The problem occurs also with windows firewall disabled

What did you expect to see?

A working http server / net listener

What did you see instead?

The following exception:

Goland run Output with listen on "127.0.0.1:9080"

GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\pc\go #gosetup
"C:\Program Files\Go\bin\go.exe" build -o C:\Users\pc\AppData\Local\Temp___1xxx.exe XXXX #gosetup
C:\Users\pc\AppData\Local\Temp\XXXX.exe #gosetup
Exception 0xc0000005 0x0 0x7fff1c490fff 0x28db33c0000
PC=0x28db33c0000
runtime: unknown pc 0x28db33c0000
stack: frame={sp:0xae281ff310, fp:0x0} stack=[0x0,0xae281ffb70)
000000ae281ff210: 000000ae281ff258 000000ae281ff280
000000ae281ff220: 000000ae281ff248 000000ae281ff240
000000ae281ff230: 000000ae281ff244 0000028db31b0f00
000000ae281ff240: 0000000000000000 0000000000000000
000000ae281ff250: 0000000000000000 0000000000000005
000000ae281ff260: 000000ae281ff3a8 00007fff19e9074c
000000ae281ff270: 0000028db31f2f50 00007fff1c50345e
000000ae281ff280: 00007fff1c4d00e8 0000028db321cc70
000000ae281ff290: 00007fff19e90746 000000ae281ff2e0
000000ae281ff2a0: 004f0044004e0049 0053005c00530057
000000ae281ff2b0: 0000028db31f2f50 0000000000000000
000000ae281ff2c0: 0000028db3203320 0066006f00050005
000000ae281ff2d0: 00007fff19e90746 0000000000000000
000000ae281ff2e0: 00007fff00000000 00007fff1c3d00e8
000000ae281ff2f0: 0000000000000000 0000000000000000
000000ae281ff300: 0000000000000001 00007fff1c502513
000000ae281ff310: <0000028d00000001 0000000000000000
000000ae281ff320: 0000000000000000 000000ae281ff418
000000ae281ff330: 0000000000000000 0000000000000000
000000ae281ff340: 0000000000000000 0000000000000000
000000ae281ff350: 0000028db321cc70 00007fff1c469070
000000ae281ff360: 0000028db31f35a0 00007fff1c46aa1c
000000ae281ff370: 0000000000000661 00007fff1a47d3a0
000000ae281ff380: 00007fff1a4496b0 00007fff1c469098
000000ae281ff390: 00007fff1c476f7c 00007fff1a390000
000000ae281ff3a0: 00007fff1c46c3a0 00007fff1c541150
000000ae281ff3b0: 0000000000000000 0000000000000000
000000ae281ff3c0: 0000000000000000 0000000000000000
000000ae281ff3d0: 0000000000000000 000000000000003c
000000ae281ff3e0: 0000000000000004 00007fff1c63a3f0
000000ae281ff3f0: 0000000000000001 000000ae281ff500
000000ae281ff400: 0000028db3203320 00007fff1c52eb58
runtime: unknown pc 0x28db33c0000
stack: frame={sp:0xae281ff310, fp:0x0} stack=[0x0,0xae281ffb70)
000000ae281ff210: 000000ae281ff258 000000ae281ff280
000000ae281ff220: 000000ae281ff248 000000ae281ff240
000000ae281ff230: 000000ae281ff244 0000028db31b0f00
000000ae281ff240: 0000000000000000 0000000000000000
000000ae281ff250: 0000000000000000 0000000000000005
000000ae281ff260: 000000ae281ff3a8 00007fff19e9074c
000000ae281ff270: 0000028db31f2f50 00007fff1c50345e
000000ae281ff280: 00007fff1c4d00e8 0000028db321cc70
000000ae281ff290: 00007fff19e90746 000000ae281ff2e0
000000ae281ff2a0: 004f0044004e0049 0053005c00530057
000000ae281ff2b0: 0000028db31f2f50 0000000000000000
000000ae281ff2c0: 0000028db3203320 0066006f00050005
000000ae281ff2d0: 00007fff19e90746 0000000000000000
000000ae281ff2e0: 00007fff00000000 00007fff1c3d00e8
000000ae281ff2f0: 0000000000000000 0000000000000000
000000ae281ff300: 0000000000000001 00007fff1c502513
000000ae281ff310: <0000028d00000001 0000000000000000
000000ae281ff320: 0000000000000000 000000ae281ff418
000000ae281ff330: 0000000000000000 0000000000000000
000000ae281ff340: 0000000000000000 0000000000000000
000000ae281ff350: 0000028db321cc70 00007fff1c469070
000000ae281ff360: 0000028db31f35a0 00007fff1c46aa1c
000000ae281ff370: 0000000000000661 00007fff1a47d3a0
000000ae281ff380: 00007fff1a4496b0 00007fff1c469098
000000ae281ff390: 00007fff1c476f7c 00007fff1a390000
000000ae281ff3a0: 00007fff1c46c3a0 00007fff1c541150
000000ae281ff3b0: 0000000000000000 0000000000000000
000000ae281ff3c0: 0000000000000000 0000000000000000
000000ae281ff3d0: 0000000000000000 000000000000003c
000000ae281ff3e0: 0000000000000004 00007fff1c63a3f0
000000ae281ff3f0: 0000000000000001 000000ae281ff500
000000ae281ff400: 0000028db3203320 00007fff1c52eb58
rax 0x7fff1a47dd34
rbx 0x7fff1a47dd32
rcx 0x42
rdi 0xffffffffffbadd11
rsi 0x0
rbp 0xae281ff600
rsp 0xae281ff310
r8 0x0
r9 0x0
r10 0x0
r11 0x660
r12 0xc000007a
r13 0x0
r14 0x7fff1a47dd34
r15 0x7fff1c3d0000
rip 0x28db33c0000
rflags 0x10202
cs 0x33
fs 0x53
gs 0x2b

Goland run Output with listen on ":9080"

GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\pc\go #gosetup
"C:\Program Files\Go\bin\go.exe" build -o C:\Users\pc\AppData\Local\Temp___1xxx.exe xxx #gosetup
C:\Users\pc\AppData\Local\Temp___1xxx.exe #gosetup
2021/05/12 15:59:01 starting server...
Exception 0xc0000005 0x0 0x7fff1c6d2fff 0x1b854d00000
windows
PC=0x1b854d00000

syscall.Syscall6(0x7fff1bf056b0, 0x6, 0x2, 0x1, 0x0, 0x0, 0x0, 0x81, 0x0, 0x0, ...)
C:/Program Files/Go/src/runtime/syscall_windows.go:343 +0xf2
internal/syscall/windows.WSASocket(0x100000002, 0x0, 0x0, 0x8100000000, 0x0, 0x65b420, 0x7b0298)
C:/Program Files/Go/src/internal/syscall/windows/zsyscall_windows.go:321 +0xca
net.sysSocket(0x2, 0x1, 0x0, 0x10, 0x7f28e0, 0x10)
C:/Program Files/Go/src/net/sock_windows.go:20 +0x66
net.socket(0x71fb90, 0xc0000ac058, 0x6f60d7, 0x3, 0x2, 0x1, 0x0, 0x0, 0x71ff40, 0xc00001a060, ...)
C:/Program Files/Go/src/net/sock_posix.go:19 +0x65
net.internetSocket(0x71fb90, 0xc0000ac058, 0x6f60d7, 0x3, 0x71ff40, 0xc00001a060, 0x0, 0x0, 0x1, 0x0, ...)
C:/Program Files/Go/src/net/ipsock_posix.go:141 +0x170
net.(*sysListener).listenTCP(0xc0000d7e38, 0x71fb90, 0xc0000ac058, 0xc00001a060, 0x71f0d8, 0xc00001a060, 0x3)
C:/Program Files/Go/src/net/tcpsock_posix.go:168 +0xbe
net.(*ListenConfig).Listen(0xc0000d7ed0, 0x71fb90, 0xc0000ac058, 0x6f60d7, 0x3, 0x6f7ba9, 0xe, 0x6ade33, 0x6c6bc5, 0x62a256, ...)
C:/Program Files/Go/src/net/dial.go:636 +0x5f9
net.Listen(0x6f60d7, 0x3, 0x6f7ba9, 0xe, 0x1, 0x8, 0x0, 0x0)
C:/Program Files/Go/src/net/dial.go:706 +0x87
main.main()
XXX/main.go:17 +0x10b
rax 0x7fff19410b92
rbx 0x7fff19410b90
rcx 0x77
rdi 0xffffffffffbadd11
rsi 0x0
rbp 0x0
rsp 0x26db1fee30
r8 0x97c
r9 0x97c
r10 0x97c
r11 0x97c
r12 0xc000007a
r13 0x0
r14 0x7fff19410b92
r15 0x7fff1c4d0000
rip 0x1b854d00000
rflags 0x10202
cs 0x33
fs 0x53
gs 0x2b

@heschi heschi added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows labels May 12, 2021
@heschi heschi added this to the Backlog milestone May 12, 2021
@heschi
Copy link
Contributor

heschi commented May 12, 2021

This is a low-level crash in the runtime, not likely to be related to the program itself. I suggest disabling any antivirus software you have running.

cc @bradfitz @ianlancetaylor @bufflig

@heschi heschi changed the title HTTP listener / net.Listener runtime error on windows net: Listener crashes on windows May 13, 2021
@almartino
Copy link
Author

We tried the following steps:

  • uninstall the antivirus software
  • disable windows defender firewall
  • disable windows defender real-time protection

Same result.

@networkimprov
Copy link

On which version of Windows OS does this happen?

Could you try this

set GODEBUG=asyncpreemptoff=1
go run main.go

If that doesn't help, what happens if you close the Conn object returned by Accept?

cc @alexbrainman @mattn @zx2c4

@zx2c4
Copy link
Contributor

zx2c4 commented May 18, 2021

I'm unable to reproduce this bug on Windows 10.

@alexbrainman
Copy link
Member

@almartino I also cannot reproduce this running on current Go tip on Windows 10

C:\>test
2021/05/19 18:23:24 starting server...
windows
^C
C:\>

Sorry, but I don't have time to debug this.

Alex

@networkimprov
Copy link

I do this when installing a network server on Windows, altho I don't think it's the cause of your error:

netsh advfirewall firewall add rule action=allow protocol=tcp enable=yes direction=in ^
      profile=domain,private,public name=appname program="pathname"

@almartino
Copy link
Author

On which version of Windows OS does this happen?

Could you try this

set GODEBUG=asyncpreemptoff=1
go run main.go

If that doesn't help, what happens if you close the Conn object returned by Accept?

cc @alexbrainman @mattn @zx2c4

  • Windows 10 Home 2004 (build SO 19041.985)
  • With set GODEBUG=asyncpreemptoff=1 the error is the same and I can't close the Conn because the program crashes after go run

@almartino
Copy link
Author

I don't know if this can help, but the same "crash" occurs when I build the executable.

netcrash.zip

@alexbrainman
Copy link
Member

@almartino what I would do is download original version of Go and try it instead of using IDE.

You can download latest version in a zip file, for example

https://golang.org/dl/go1.16.4.windows-amd64.zip

from

https://golang.org/dl/

Then unzip it somewhere on your system. And then open cmd.exe and try building your program from command line by using go build command, and then try running built program.

To be able to run correct Go version (the one that you unzipped to your disk), you would have to modify your PATH variable before you build your program. You can temporarily change PATH when you open cmd.exe program. Just do this command:

set PATH=c:\directory_where_you_unzipped_go\bin;%PATH%

Just run go version before building the program to make sure you use correct version.

Alex

@almartino
Copy link
Author

Hi @alexbrainman , we followed your suggested steps, same results.

@alexbrainman
Copy link
Member

Hi @alexbrainman , we followed your suggested steps, same results.

Did you run go version command. Please show output of it.

Same for go build command. Show output of go build command.

Same for executing your program. Show output of your program.

Thank you.

Alex

@networkimprov
Copy link

Does this happen for a simple "hello world" program with only import "fmt" or is the net.Listen call required to trigger it?

Can you try a similar program in a different language (C#, C, Python, etc) on that machine?

@almartino
Copy link
Author

Hi @alexbrainman , we followed your suggested steps, same results.

Did you run go version command. Please show output of it.

Same for go build command. Show output of go build command.

Same for executing your program. Show output of your program.

Thank you.

Alex

We unzipped the latest version into C:\Users\pc\Desktop\tmp\go

Go run

C:\Users\pc\projects\testProject>set PATH=C:\Users\pc\Desktop\tmp\go\bin
C:\Users\pc\projects\testProject>go version
go version go1.16.4 windows/amd64
C:\Users\pc\projects\testProject>go env GOROOT
C:\Users\pc\Desktop\tmp\go
C:\Users\pc\projects\testProject>go run main.go
Exception 0xc0000005 0x0 0x7ffe7eb52fff 0x18eeec80000
...

Go build

(same terminal instance after SET command)

C:\Users\pc\projects\testProject>go build
C:\Users\pc\projects\testProject>dir
 Directory of C:\Users\pc\projects\testProject
25/05/2021  09:49    <DIR>          .
25/05/2021  09:49    <DIR>          ..
25/05/2021  09:46    <DIR>          .idea
25/05/2021  09:49                21 go.mod
24/05/2021  11:13               190 main.go
25/05/2021  09:49         6.062.080 test.exe
               3 File      6.062.291 byte
               3 Directory  47.825.817.600 bytes
C:\Users\pc\projects\testProject>test.exe
Exception 0xc0000005 0x0 0x7ffe7eb52fff 0x15d69e50000
...

@almartino
Copy link
Author

Does this happen for a simple "hello world" program with only import "fmt" or is the net.Listen call required to trigger it?

Can you try a similar program in a different language (C#, C, Python, etc) on that machine?

the net.Listen call triggers the issue.
We also tried a simple java http server copied from Stackoverflow
(using the same port of the go program)

@networkimprov
Copy link

networkimprov commented May 25, 2021

And your Java program runs fine?

Did you try the command I suggested in #46125 (comment)? (Requires Admin privs.)

@almartino
Copy link
Author

And your Java program runs fine?

Did you try the command I suggested in #46125 (comment)? (Requires Admin privs.)

Yes, the java program runs fine, and the "test" handler works when invoked.
Yes, we also tried the command suggested in #46125 (comment), same result.

Additionally, I built the executable from my linux machine with
GOOS=windows GOARCH=amd64 go build -o test.exe ./main.go
And then we executed on the windows machine with no luck... The exception is the same.

@alexbrainman
Copy link
Member

C:\Users\pc\projects\testProject>go build
C:\Users\pc\projects\testProject>dir
Directory of C:\Users\pc\projects\testProject
25/05/2021 09:49

.
25/05/2021 09:49 ..
25/05/2021 09:46 .idea
25/05/2021 09:49 21 go.mod
24/05/2021 11:13 190 main.go
25/05/2021 09:49 6.062.080 test.exe
3 File 6.062.291 byte
3 Directory 47.825.817.600 bytes
C:\Users\pc\projects\testProject>test.exe
Exception 0xc0000005 0x0 0x7ffe7eb52fff 0x15d69e50000
...

We need to see complete stack trace output by test.exe program. Also

set GOTRACEBACK=crash

before you run test.exe so we can see as much detailed stacktrace as possible.

It appears that your go build command works fine on your computer. So it is running the program executable is the problem. Can you try and run your test.exe on another Windows computer?

Thank you.

Alex

@almartino
Copy link
Author

almartino commented May 25, 2021

C:\Users\pc\projects\testProject>go build
C:\Users\pc\projects\testProject>dir
Directory of C:\Users\pc\projects\testProject
25/05/2021 09:49 .
25/05/2021 09:49 ..
25/05/2021 09:46 .idea
25/05/2021 09:49 21 go.mod
24/05/2021 11:13 190 main.go
25/05/2021 09:49 6.062.080 test.exe
3 File 6.062.291 byte
3 Directory 47.825.817.600 bytes
C:\Users\pc\projects\testProject>test.exe
Exception 0xc0000005 0x0 0x7ffe7eb52fff 0x15d69e50000
...

We need to see complete stack trace output by test.exe program. Also

set GOTRACEBACK=crash

before you run test.exe so we can see as much detailed stacktrace as possible.

It appears that your go build command works fine on your computer. So it is running the program executable is the problem. Can you try and run your test.exe on another Windows computer?

Thank you.

Alex

Sorry I reported a bad info:
The executable built from my linux machine works fine on the windows machine without the exception (accept the connection, then closes the connection and terminates with exit code 0). I also tried the executable on another Windows VM and works without any problems.


Stack trace with set GOTRACEBACK=crash. We used the "system" installed golang version, which is 1.15.12. If you need I can post also the stacktrace with the latest version.
go run main.go
Exception 0xc0000005 0x0 0x7ffe7eb52fff 0x1f9b76d0000
PC=0x1f9b76d0000
​
runtime.cgocall(0xacbda0, 0xea67a0, 0x0)
        C:/Program Files/Go/src/runtime/cgocall.go:133 +0x55 fp=0xc0000759b0 sp=0xc000075978 pc=0xa64795
syscall.Syscall6(0x7ffe7d7856b0, 0x6, 0x2, 0x1, 0x6, 0x0, 0x0, 0x81, 0x0, 0x0, ...)
        C:/Program Files/Go/src/runtime/syscall_windows.go:201 +0xf2 fp=0xc0000759f0 sp=0xc0000759b0 pc=0xac73d2
internal/syscall/windows.WSASocket(0x100000002, 0xc000000006, 0x0, 0x8100000000, 0x10, 0x10, 0xca5a20)
        C:/Program Files/Go/src/internal/syscall/windows/zsyscall_windows.go:122 +0xcc fp=0xc000075a70 sp=0xc0000759f0 pc=0xb2cecc
net.sysSocket(0x2, 0x1, 0x6, 0xea64e0, 0x0, 0xcf1d65)
        C:/Program Files/Go/src/net/sock_windows.go:20 +0x66 fp=0xc000075ad0 sp=0xc000075a70 pc=0xbbaa66
net.(*ipStackCapabilities).probe(0xed82d0)
        C:/Program Files/Go/src/net/ipsock_posix.go:27 +0x55 fp=0xc000075bc0 sp=0xc000075ad0 pc=0xbb2c75
net.(*ipStackCapabilities).probe-fm()
        C:/Program Files/Go/src/net/ipsock_posix.go:26 +0x31 fp=0xc000075bd8 sp=0xc000075bc0 pc=0xbc2ef1
sync.(*Once).doSlow(0xed82d0, 0xc000075c38)
        C:/Program Files/Go/src/sync/once.go:66 +0xf7 fp=0xc000075c28 sp=0xc000075bd8 pc=0xad60f7
sync.(*Once).Do(...)
        C:/Program Files/Go/src/sync/once.go:57
net.supportsIPv4map(0xc000064ba0)
        C:/Program Files/Go/src/net/ipsock.go:47 +0x7d fp=0xc000075c58 sp=0xc000075c28 pc=0xbb0e7d
net.favoriteAddrFamily(0xcf1a84, 0x3, 0xd486a0, 0xc000064ba0, 0x0, 0x0, 0xcf211b, 0x6, 0xcf1d64, 0x5)
        C:/Program Files/Go/src/net/ipsock_posix.go:120 +0x137 fp=0xc000075c78 sp=0xc000075c58 pc=0xbb30d7
net.internetSocket(0xd47860, 0xc00000a048, 0xcf1a84, 0x3, 0xd486a0, 0xc000064ba0, 0x0, 0x0, 0x1, 0x0, ...)
        C:/Program Files/Go/src/net/ipsock_posix.go:140 +0xca fp=0xc000075d08 sp=0xc000075c78 pc=0xbb32aa
net.(*sysListener).listenTCP(0xc000075e48, 0xd47860, 0xc00000a048, 0xc000064ba0, 0xd45160, 0xc000064ba0, 0x3)
        C:/Program Files/Go/src/net/tcpsock_posix.go:168 +0xbe fp=0xc000075da0 sp=0xc000075d08 pc=0xbbcbbe
net.(*ListenConfig).Listen(0xc000075ee0, 0xd47860, 0xc00000a048, 0xcf1a84, 0x3, 0xcf1d64, 0x5, 0xd8, 0x1f992390108, 0xc000126000, ...)
        C:/Program Files/Go/src/net/dial.go:636 +0x5d9 fp=0xc000075e88 sp=0xc000075da0 pc=0xbaa9f9
net.Listen(0xcf1a84, 0x3, 0xcf1d64, 0x5, 0xe0, 0xce9a60, 0xea5f01, 0xc000126000)
        C:/Program Files/Go/src/net/dial.go:706 +0x87 fp=0xc000075f00 sp=0xc000075e88 pc=0xbaaaa7
net/http.(*Server).ListenAndServe(0xc000126000, 0xc000126000, 0x6)
        C:/Program Files/Go/src/net/http/server.go:2862 +0x79 fp=0xc000075f50 sp=0xc000075f00 pc=0xc74cd9
net/http.ListenAndServe(...)
        C:/Program Files/Go/src/net/http/server.go:3120
main.main()
        C:/Users/pc/projects/testProject/main.go:9 +0x9d fp=0xc000075f88 sp=0xc000075f50 pc=0xc854dd
runtime.main()
        C:/Program Files/Go/src/runtime/proc.go:204 +0x209 fp=0xc000075fe0 sp=0xc000075f88 pc=0xa9b409
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc000075fe8 sp=0xc000075fe0 pc=0xaca621
​
goroutine 2 [force gc (idle)]:
runtime.gopark(0xd09a58, 0xea59a0, 0x1411, 0x1)
        C:/Program Files/Go/src/runtime/proc.go:306 +0xfa fp=0xc000027fb0 sp=0xc000027f90 pc=0xa9b7da
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:312
runtime.forcegchelper()
        C:/Program Files/Go/src/runtime/proc.go:255 +0xcd fp=0xc000027fe0 sp=0xc000027fb0 pc=0xa9b66d
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc000027fe8 sp=0xc000027fe0 pc=0xaca621
created by runtime.init.6
        C:/Program Files/Go/src/runtime/proc.go:243 +0x3c
​
goroutine 3 [GC sweep wait]:
runtime.gopark(0xd09a58, 0xea5aa0, 0x140c, 0x1)
        C:/Program Files/Go/src/runtime/proc.go:306 +0xfa fp=0xc000029fa8 sp=0xc000029f88 pc=0xa9b7da
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:312
runtime.bgsweep(0xc000014070)
        C:/Program Files/Go/src/runtime/mgcsweep.go:163 +0xb2 fp=0xc000029fd8 sp=0xc000029fa8 pc=0xa85412
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc000029fe0 sp=0xc000029fd8 pc=0xaca621
created by runtime.gcenable
        C:/Program Files/Go/src/runtime/mgc.go:217 +0x67
​
goroutine 4 [GC scavenge wait]:
runtime.gopark(0xd09a58, 0xea5d40, 0x140d, 0x1)
        C:/Program Files/Go/src/runtime/proc.go:306 +0xfa fp=0xc000035f78 sp=0xc000035f58 pc=0xa9b7da
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:312
runtime.bgscavenge(0xc000014070)
        C:/Program Files/Go/src/runtime/mgcscavenge.go:265 +0xe5 fp=0xc000035fd8 sp=0xc000035f78 pc=0xa833e5
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc000035fe0 sp=0xc000035fd8 pc=0xaca621
created by runtime.gcenable
        C:/Program Files/Go/src/runtime/mgc.go:218 +0x89
​
goroutine 5 [finalizer wait]:
runtime.gopark(0xd09a58, 0xed80b0, 0xca1410, 0x1)
        C:/Program Files/Go/src/runtime/proc.go:306 +0xfa fp=0xc00002bf58 sp=0xc00002bf38 pc=0xa9b7da
runtime.goparkunlock(...)
        C:/Program Files/Go/src/runtime/proc.go:312
runtime.runfinq()
        C:/Program Files/Go/src/runtime/mfinal.go:175 +0xb2 fp=0xc00002bfe0 sp=0xc00002bf58 pc=0xa7a112
runtime.goexit()
        C:/Program Files/Go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc00002bfe8 sp=0xc00002bfe0 pc=0xaca621
created by runtime.createfing
        C:/Program Files/Go/src/runtime/mfinal.go:156 +0x68
rax     0x7ffe7b8d0b92
rbx     0x7ffe7b8d0b90
rcx     0x77
rdi     0xffffffffffbadd11
rsi     0x0
rbp     0x0
rsp     0xaa029fee40
r8      0x97d
r9      0x97d
r10     0x97d
r11     0x97d
r12     0xc000007a
r13     0x0
r14     0x7ffe7b8d0b92
r15     0x7ffe7e950000
rip     0x1f9b76d0000
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b
exit status 2

@networkimprov
Copy link

Since the executable built on Linux works, it might help to see a comparison of that with the executable built on Windows.

cc @ianlancetaylor for suggestions on comparing executable files...

@alexbrainman
Copy link
Member

The executable built from my linux machine works fine on the windows machine without the exception (accept the connection, then closes the connection and terminates with exit code 0).

Good.

I also tried the executable on another Windows VM and works without any problems.

Good.

net/http.ListenAndServe(...)
C:/Program Files/Go/src/net/http/server.go:3120
main.main()
C:/Users/pc/projects/testProject/main.go:9 +0x9d fp=0xc000075f88 sp=0xc000075f50 pc=0xc854dd
runtime.main()
C:/Program Files/Go/src/runtime/proc.go:204 +0x209 fp=0xc000075fe0 sp=0xc000075f88 pc=0xa9b409

The stack trace you posted says that your program is running net/http.ListenAndServe, but your original issue #46125 (comment) does not mention net/http.ListenAndServe.

I need complete source code to be able to reproduce your problem. So, please, provide your program source and version of go that use. And do not use go run - just run your program directly. Less things to go wrong. Just do these commands

type main.go
go version
go build -o test.exe
set GOTRACEBACK=crash
test

and provide complete output of these commands.

Thank you.

Alex

@almartino
Copy link
Author

Sorry for the delay, I can't investigate more this problem because it is on my colleague's machine.
I'm closing the issue for the moment.
If we find time/situation to do some more testing I'll reopen this.

Thanks for your help.

Alberto

@golang golang locked and limited conversation to collaborators Jun 9, 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
Projects
None yet
Development

No branches or pull requests

6 participants