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: GODEBUG=netdns=go massive DNS lookups crash w/ "runtime/cgo: pthread_create failed: Resource temporarily unavailable" #15659

Closed
mikioh opened this issue May 12, 2016 · 6 comments

Comments

Projects
None yet
3 participants
@mikioh
Copy link
Contributor

commented May 12, 2016

This happens on darwin 21d7810 and doesn't happen on darwin go1.6, and not sure whether darwin-specific issue.

Caution: TestLookupIPDeadline in lookup_test.go is a bad test in bad manner. It generates massive DNS queries to confirm that the net package doesn't create system threads extravagantly. Before testing, you need to make sure whether the flood is acceptable to your circumstances.

When we run go test -v -run=TestLookupIPDeadline -dnsflood -count=10, the expected result is that probably the test may fail but not crash. On tip, TestLookupIPDeadline crashes unfortunately.

# export CGO_ENABLED=1
# go build

# export GODEBUG=netdns=cgo
# go test -v -run=IPDeadline -dnsflood -count=10
=== RUN   TestLookupIPDeadline
(snip)
ok      net 30.542s

# export GODEBUG=netdns=go
# go test -v -run=IPDeadline -dnsflood -count=10
=== RUN   TestLookupIPDeadline
runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
PC=0x7fff84223f06 m=2
(snip)
rax    0x0
rbx    0x6
rcx    0x700000080bd8
rdx    0x0
rdi    0xd03
rsi    0x6
rbp    0x700000080c00
rsp    0x700000080bd8
r8     0x40
r9     0x7fff74c4b1e0
r10    0x8000000
r11    0x206
r12    0xc9001070bc281990
r13    0x30
r14    0x700000081000
r15    0x700000080c58
rip    0x7fff84223f06
rflags 0x206
cs     0x7
fs     0x0
gs     0x0
exit status 2

Not sure the reason why GODEBUG=netdns=go DNS lookups on tip require the functionality of runtime/cgo.

@mikioh mikioh added this to the Go1.7 milestone May 12, 2016

@minux

This comment has been minimized.

Copy link
Member

commented May 12, 2016

@mikioh

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2016

The problem is, I guess, in go1.6 GODEBUG=netdns=go never invokes C.getaddrinfo and friends via cgo, but looks like tip uses them.

@mikioh

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2016

but looks like tip uses them.

Nope, the series of cgoLookup are not called during the test. Who is the main culprit?

@minux

This comment has been minimized.

Copy link
Member

commented May 12, 2016

@mikioh mikioh added the OS-Darwin label May 12, 2016

@mikioh

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2016

Okay, I now understand why I'm confused; simply, a) Darwin consumes various kernel resources more than I expect because of probably bridging cosumer thread cancelation stuff and Mach stuff, b) there was no -test.count flag in go1.4 and I used -test.cpu flag when I added TestLookupIPDeadline. There is no big difference about the # of cosumed Ms via runtime.newm between go1.4 and tip. Thanks.

@mikioh mikioh closed this May 12, 2016

@gopherbot

This comment has been minimized.

Copy link

commented May 13, 2016

CL https://golang.org/cl/23077 mentions this issue.

gopherbot pushed a commit that referenced this issue May 21, 2016

Mikio Hara
net: don't crash DNS flood test on darwin
Also renames the test function to TestDNSFlood.

Updates #15659.

Change-Id: Ia562004c43bcc19c2fee9440321c27b591f85da5
Reviewed-on: https://go-review.googlesource.com/23077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>

@golang golang locked and limited conversation to collaborators May 13, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.