Skip to content

Commit 7042281

Browse files
authored
Trigger the runtime profiler when a test times out. (#330)
1 parent 1ebc4c9 commit 7042281

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/runtests.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,17 @@ try
241241
end
242242
wrkr = p
243243

244-
local resp
245-
246244
# catch timeouts
247245
pid = remotecall_fetch(getpid, wrkr)
248246
timer = Timer(480) do _
249247
@warn "Test timed out: $test"
250-
t1 = rmprocs(wrkr, waitfor=0)
251248

252-
# rmprocs may fail if the worker is stuck, so fall back to kill
249+
# trigger a stacktrace and profile dump
250+
ccall(:kill, Cint, (Cint, Cint), pid, #=SIGINFO=# 29)
251+
sleep(5)
252+
253+
# exit the worker (which may fail, so fall back to killing it)
254+
t1 = rmprocs(wrkr, waitfor=0)
253255
t2 = Timer(10) do _
254256
@warn "Couldn't kill worker $wrkr, killing process $pid forcefully"
255257
ccall(:kill, Cint, (Cint, Cint), pid, Base.SIGTERM)
@@ -259,12 +261,12 @@ try
259261
wait(t1)
260262
close(t3)
261263
end
262-
263264
wait(t1)
264265
close(t2)
265266
end
266267

267268
# run the test
269+
local resp
268270
running_tests[test] = now()
269271
try
270272
resp = remotecall_fetch(runtests, wrkr, test_runners[test], test)

0 commit comments

Comments
 (0)