You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- FAIL: TestVariousDeadlines (1.13s)
...
timeout_test.go:913: for 250ms run 3/3, server in 250.726305ms wrote 395146821: readfrom tcp4 127.0.0.1:35191->127.0.0.1:35775: write tcp4 127.0.0.1:35191->127.0.0.1:35775: write: connection reset by peer
timeout_test.go:878: 500ms run 1/3
timeout_test.go:882: dial tcp 127.0.0.1:35191: socket: too many open files
--- PASS: TestTCPSpuriousConnSetupCompletionWithCancel (1.18s)
=== RUN ExampleIPv4
pipe2: too many open files
exit status 1
I think it must be one of the new tests (TestTCPSpuriousConnSetupCompletion, TestTCPSpuriousConnSetupCompletionWithCancel) that are using up the file descriptors, but at the moment I'm not seeing it.
On the s390 gomote ulimit -n reports 1024, as compared to my laptop where it reports 32768. /proc/sys/fs/file-max is 808890 on s390 gomote, 1048576 on my laptop. But running the net test under strace -f doesn't use nearly that many file descriptors. The largest file descriptor number I see is 159.
OK, running strace -f on gomote s390 shows that the net test is indeed opening file descriptors up to 1023 before calls to socket start to fail with EMFILE.
with longs sequences of other unrelated system calls in the ellipses. 8.8.8.8 is the only address listed in /etc/resolv.conf in the gomote. In other words, we are creating a socket for contacting a UDP DNS server, but then we are closing that socket without writing anything to it. While that socket is open we are opening many more sockets. This pattern repeats over and over.
I think I see the problem. TestTCPSpuriousConnSetupCompletionWithCancel works by starting a bunch of connections and canceling them. The connections use a DNS lookup, because connecting to a simple IP address did not recreate the problem the test was testing for. Canceling the connection does not cancel the DNS lookup, but it does cause the singleflight to forget what it was doing. So we wind up stacking up more and more DNS lookups, using up more and more file descriptors.
Activity
ianlancetaylor commentedon Jun 16, 2017
Running using gomote, I see
I think it must be one of the new tests (
TestTCPSpuriousConnSetupCompletion,TestTCPSpuriousConnSetupCompletionWithCancel) that are using up the file descriptors, but at the moment I'm not seeing it.ianlancetaylor commentedon Jun 16, 2017
On the s390 gomote
ulimit -nreports1024, as compared to my laptop where it reports32768./proc/sys/fs/file-maxis808890on s390 gomote,1048576on my laptop. But running the net test understrace -fdoesn't use nearly that many file descriptors. The largest file descriptor number I see is159.ianlancetaylor commentedon Jun 16, 2017
OK, running
strace -fon gomote s390 shows that the net test is indeed opening file descriptors up to1023before calls tosocketstart to fail withEMFILE.ianlancetaylor commentedon Jun 16, 2017
The pattern I'm seeing is
with longs sequences of other unrelated system calls in the ellipses.
8.8.8.8is the only address listed in/etc/resolv.confin the gomote. In other words, we are creating a socket for contacting a UDP DNS server, but then we are closing that socket without writing anything to it. While that socket is open we are opening many more sockets. This pattern repeats over and over.ianlancetaylor commentedon Jun 16, 2017
I think I see the problem.
TestTCPSpuriousConnSetupCompletionWithCancelworks by starting a bunch of connections and canceling them. The connections use a DNS lookup, because connecting to a simple IP address did not recreate the problem the test was testing for. Canceling the connection does not cancel the DNS lookup, but it does cause the singleflight to forget what it was doing. So we wind up stacking up more and more DNS lookups, using up more and more file descriptors.gopherbot commentedon Jun 16, 2017
CL https://golang.org/cl/45999 mentions this issue.
gopherbot commentedon Mar 15, 2018
Change https://golang.org/cl/100840 mentions this issue:
net: don't let cancelation of a DNS lookup affect another lookupnet: don't let cancelation of a DNS lookup affect another lookup
gopherbot commentedon Mar 27, 2018
Change https://golang.org/cl/102787 mentions this issue:
[release-branch.go1.10] net: don't let cancelation of a DNS lookup affect another lookupgopherbot commentedon Mar 28, 2018
Change https://golang.org/cl/103215 mentions this issue:
[release-branch.go1.9] net: don't let cancelation of a DNS lookup affect another lookup[release-branch.go1.10] net: don't let cancelation of a DNS lookup af…