Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/gc-stock.c
Original file line number Diff line number Diff line change
Expand Up @@ -3586,7 +3586,6 @@ void jl_start_gc_threads(void)
else {
uv_thread_create(&uvtid, jl_parallel_gc_threadfun, t);
}
uv_thread_detach(&uvtid);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/signals-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ static int jl_thread_suspend_and_get_state(int tid, int timeout, bt_context_t *c
if (ct2 == NULL) // this thread is already dead
return 0;
HANDLE hThread = ptls2->system_id;
assert(GetCurrentThreadId() != GetThreadId(hThread));
if ((DWORD)-1 == SuspendThread(hThread)) {
// jl_safe_fprintf(ios_safe_stderr, "failed to suspend thread %d: %lu\n", tid, GetLastError());
return 0;
Expand Down
45 changes: 32 additions & 13 deletions stdlib/Profile/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@ end
@test occursin("@julialib" * slash, str)
end

function run_with_watchdog(cmd, timeout=120)
p = open(cmd)
t = Timer(timeout) do t
# should be under 10 seconds, so give it 2 minutes then report failure
println("KILLING debuginfo registration test BY PROFILE TEST WATCHDOG\n")
kill(p, Base.SIGQUIT)
sleep(30)
kill(p, Base.SIGQUIT)
sleep(30)
kill(p, Base.SIGKILL)
end
s = read(p, String)
close(t)
close(p)
success(p) ? s : ""
end

# Profile deadlocking in compilation (debuginfo registration)
let cmd = Base.julia_cmd()
script = """
Expand All @@ -259,24 +276,26 @@ let cmd = Base.julia_cmd()
print(Profile.len_data())
"""
# use multiple threads here to ensure that profiling works with threading
p = open(`$cmd -t2 -e $script`)
t = Timer(120) do t
# should be under 10 seconds, so give it 2 minutes then report failure
println("KILLING debuginfo registration test BY PROFILE TEST WATCHDOG\n")
kill(p, Base.SIGQUIT)
sleep(30)
kill(p, Base.SIGQUIT)
sleep(30)
kill(p, Base.SIGKILL)
end
s = read(p, String)
close(t)
@test success(p)
s = run_with_watchdog(`$cmd -t2 -e $script`)
@test !isempty(s)
@test occursin("done", s)
@test parse(Int, split(s, '\n')[end]) > 100
end

# Thread suspend deadlock - run many times (#60042)
let cmd = Base.julia_cmd()
script = """
using Profile
@profile println("done")
"""
good = true
for i=1:100
s = run_with_watchdog(`$cmd -t2 -e $script`, 5)
good &= occursin("done", s)
end
@test good
end

if Sys.isbsd() || Sys.islinux()
@testset "SIGINFO/SIGUSR1 profile triggering" begin
let cmd = Base.julia_cmd()
Expand Down