Skip to content

Commit

Permalink
show mark-queue on GC critical error (#49902)
Browse files Browse the repository at this point in the history
Re-adds the capability of showing the mark-queue on a GC critical error.
  • Loading branch information
d-netto authored May 22, 2023
1 parent e02d3ba commit 944b28c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,28 @@ STATIC_INLINE jl_gc_chunk_t gc_chunkqueue_pop(jl_gc_markqueue_t *mq) JL_NOTSAFEP
return c;
}

// Dump mark queue on critical error
JL_NORETURN NOINLINE void gc_dump_queue_and_abort(jl_ptls_t ptls, jl_datatype_t *vt) JL_NOTSAFEPOINT
{
jl_safe_printf("GC error (probable corruption)\n");
jl_gc_debug_print_status();
jl_(vt);
jl_gc_debug_critical_error();
if (jl_n_gcthreads == 0) {
jl_safe_printf("\n");
jl_value_t *new_obj;
jl_gc_markqueue_t *mq = &ptls->mark_queue;
jl_safe_printf("thread %d ptr queue:\n", ptls->tid);
jl_safe_printf("~~~~~~~~~~ ptr queue top ~~~~~~~~~~\n");
while ((new_obj = gc_ptr_queue_steal_from(mq)) != NULL) {
jl_(new_obj);
jl_safe_printf("==========\n");
}
jl_safe_printf("~~~~~~~~~~ ptr queue bottom ~~~~~~~~~~\n");
}
abort();
}

// Steal chunk from `mq2`
STATIC_INLINE jl_gc_chunk_t gc_chunkqueue_steal_from(jl_gc_markqueue_t *mq2) JL_NOTSAFEPOINT
{
Expand Down Expand Up @@ -2568,6 +2590,11 @@ FORCE_INLINE void gc_mark_outrefs(jl_ptls_t ptls, jl_gc_markqueue_t *mq, void *_
}
return;
}
else {
jl_datatype_t *vt = (jl_datatype_t *)vtag;
if (__unlikely(!jl_is_datatype(vt) || vt->smalltag))
gc_dump_queue_and_abort(ptls, vt);
}
jl_datatype_t *vt = (jl_datatype_t *)vtag;
if (vt->name == jl_array_typename) {
jl_array_t *a = (jl_array_t *)new_obj;
Expand Down

2 comments on commit 944b28c

@aviatesk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runbenchmarks("inference", vs="@d2f5bbd7cfbac902db952b465b83d242efcf6f08")

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

Please sign in to comment.