Skip to content

Commit 04e26c5

Browse files
authored
Print more network stack information if Sockets test fails (#59240)
Hopefully will help debug #38711.
1 parent d268106 commit 04e26c5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stdlib/Sockets/test/runtests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
using Sockets, Random, Test
44
using Base: Experimental
55

6+
# This is for debugging only - if the system doesn't have `netstat`, we just ignore it
7+
netstat() = try; read(ignorestatus(`netstat -ndi`), String); catch; return ""; end
8+
const netstat_before = netstat()
9+
610
# set up a watchdog alarm for 10 minutes
711
# so that we can attempt to get a "friendly" backtrace if something gets stuck
812
# (although this'll also terminate any attempted debugging session)
913
# expected test duration is about 5-10 seconds
1014
function killjob(d)
1115
Core.print(Core.stderr, d)
16+
Core.print(Core.stderr, "Netstat before:\n")
17+
Core.print(Core.stderr, netstat_before)
18+
Core.print(Core.stderr, "\nNetstat after:\n")
19+
# This might fail if we're in a bad libuv state
20+
Core.print(Core.stderr, netstat())
1221
if Sys.islinux()
1322
SIGINFO = 10
1423
elseif Sys.isbsd()

0 commit comments

Comments
 (0)