Skip to content

Commit e213592

Browse files
kpamnanyd-netto
authored andcommitted
don't print task backtrace for GC threads (JuliaLang#51413) (#78)
GC threads don't have tasks associated with them. Co-authored-by: Diogo Netto <61364108+d-netto@users.noreply.github.com>
1 parent 76807af commit e213592

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/stackwalk.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,8 @@ JL_DLLEXPORT void jl_print_backtrace(void) JL_NOTSAFEPOINT
11361136
jlbacktrace();
11371137
}
11381138

1139+
extern int gc_first_tid;
1140+
11391141
// Print backtraces for all live tasks, for all threads.
11401142
// WARNING: this is dangerous and can crash if used outside of gdb, if
11411143
// all of Julia's threads are not stopped!
@@ -1144,6 +1146,10 @@ JL_DLLEXPORT void jl_print_task_backtraces(int show_done) JL_NOTSAFEPOINT
11441146
size_t nthreads = jl_atomic_load_acquire(&jl_n_threads);
11451147
jl_ptls_t *allstates = jl_atomic_load_relaxed(&jl_all_tls_states);
11461148
for (size_t i = 0; i < nthreads; i++) {
1149+
// skip GC threads since they don't have tasks
1150+
if (gc_first_tid <= i && i < gc_first_tid + jl_n_gcthreads) {
1151+
continue;
1152+
}
11471153
jl_ptls_t ptls2 = allstates[i];
11481154
arraylist_t *live_tasks = &ptls2->heap.live_tasks;
11491155
size_t n = live_tasks->len;

0 commit comments

Comments
 (0)