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
Comments
The program requires cgo because the net package is compiled with
cgo support. It doesn't matter the runtime choice is to use the pure
Go resolver.
If the program uses cgo, then Go cannot create threads on its own,
and it must use pthread_create to create threads in order to
cooperate with cgo (actually, dynamically linked programs on
Darwin can't create threads without pthread.)
|
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. |
Nope, the series of cgoLookup are not called during the test. Who is the main culprit? |
Whether the program calls cgo functions doesn't matter.
If the program is built with cgo, then it will use pthread
to create threads.
|
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. |
CL https://golang.org/cl/23077 mentions this issue. |
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>
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.Not sure the reason why GODEBUG=netdns=go DNS lookups on tip require the functionality of runtime/cgo.
The text was updated successfully, but these errors were encountered: