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

go/src/net/lookup.go panic #42247

Open
EdwardTanshuo opened this issue Oct 28, 2020 · 6 comments
Open

go/src/net/lookup.go panic #42247

EdwardTanshuo opened this issue Oct 28, 2020 · 6 comments

Comments

@EdwardTanshuo
Copy link

@EdwardTanshuo EdwardTanshuo commented Oct 28, 2020

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

$ 1.13

Does this issue reproduce with the latest release?

It's very hard to reproduce, the project has run good in the product env for one year.

What did you do?

Our project uses official net library to connect to a remote server. It's weird to see a panic occurs in the online environment. We find out it's a panic thrown by the dnsWaitGroup (located in /go/src/net/lookup.go:266) which should only be waited in unit tests.

What did you expect to see?

no panic occur

What did you see instead?

err:sync: WaitGroup misuse: Add called concurrently with Wait

panic(0xf17d60, 0x12adb10)
	/usr/local/go/src/runtime/panic.go:679 +0x1b2
sync.(*WaitGroup).Add(0x1c4bcf8, 0x1)
	/usr/local/go/src/sync/waitgroup.go:77 +0x11d
net.(*Resolver).lookupIPAddr(0x1c2db00, 0x12e70e0, 0xc004724780, 0xc0001460fd, 0x3, 0xc000146101, 0x2b, 0xcea, 0x0, 0x0, ...)
	/usr/local/go/src/net/lookup.go:266 +0x49f
net.(*Resolver).internetAddrList(0x1c2db00, 0x12e70e0, 0xc004724780, 0xc0001460fd, 0x3, 0xc000146101, 0x30, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/net/ipsock.go:280 +0x605
net.(*Resolver).resolveAddrList(0x1c2db00, 0x12e70e0, 0xc004724780, 0x1136d15, 0x4, 0xc0001460fd, 0x3, 0xc000146101, 0x30, 0x0, ...)
	/usr/local/go/src/net/dial.go:220 +0x506
net.(*Dialer).DialContext(0xc0017520d8, 0x12e70a0, 0xc000040298, 0xc0001460fd, 0x3, 0xc000146101, 0x30, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/net/dial.go:402 +0x1fe
net.(*Dialer).Dial(...)
	/usr/local/go/src/net/dial.go:347
@davecheney
Copy link
Contributor

@davecheney davecheney commented Oct 28, 2020

This looks like memory corruption. Have you tried running your program under the race detector? See https://blog.golang.org/race-detector .

@davecheney
Copy link
Contributor

@davecheney davecheney commented Oct 28, 2020

Please upgrade to go 1.15.3, go 1.13 is not longer supported

@EdwardTanshuo
Copy link
Author

@EdwardTanshuo EdwardTanshuo commented Oct 28, 2020

This looks like memory corruption. Have you tried running your program under the race detector? See https://blog.golang.org/race-detector .

it's a very common code, gorm db client connect remote server and then panic when connections number grew up. I run our project with the race flag, it looks good.

@davecheney
Copy link
Contributor

@davecheney davecheney commented Oct 28, 2020

Have you build and deployed a race enabled version of your program to verify that there are no races under production code?

@EdwardTanshuo
Copy link
Author

@EdwardTanshuo EdwardTanshuo commented Oct 28, 2020

Have you build and deployed a race enabled version of your program to verify that there are no races under production code?

It's hard, the online deployment is build by CI, we could not incept into it

@davecheney
Copy link
Contributor

@davecheney davecheney commented Oct 28, 2020

Then your best bet is to upgrade to a supported version of Go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants