JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
44.95k stars 5.42k forks source link

jl_static_show is not safe to be called from within the GC #53724

Open d-netto opened 3 months ago

d-netto commented 3 months ago

jl_static_show is used to pretty-print types when the GC has a critical error and it's also used inside the heap snapshot, which runs inside the GC.

jl_static_show, however, may grab a lock in a few cases, which will read from the safepoint page and cause a segfault if we're running GC at that point.

gbaraldi commented 3 months ago

Those locks should probably use the NOGC version? Do you know where we might take those?

vtjnash commented 3 months ago

AFAIK, the only violation is the call to jl_is_operator, which is because this function is quite tedious to convert into straight C code, but requires a whole flisp context object to run this query.