# New Ticket Created by Bram Geron # Please include the string: [perl #44351] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44351 >
When GC_VERBOSE=1 and tracing is on, Parrot spits out messages about PObjs getting destroyed. These messages are getting spit out with PIO_eprintf, which accesses the ParrotIO object for stderr. The problem is that at Parrot_exit, all PObjs are destroyed (including ParrotIO objects), and trying to spit out such messages will fail with a SIGSEGV. This patch turns off such tracing with a notice just before force-destroying all PObjs (no matter the setting of GC_VERBOSE). Without tracing enabled, it does nothing. include/parrot/dod.h | 3 ++- src/inter_create.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) -- Bram Geron | GPG 0xE7B9E65E
diff --git a/include/parrot/dod.h b/include/parrot/dod.h index 79c1831..15df0e0 100644 --- a/include/parrot/dod.h +++ b/include/parrot/dod.h @@ -44,7 +44,8 @@ #define DOD_trace_stack_FLAG (UINTVAL)(1 << 0) /* trace system areads and stack */ #define DOD_trace_normal (UINTVAL)(1 << 0) /* the same */ #define DOD_lazy_FLAG (UINTVAL)(1 << 1) /* timely destruction run */ -#define DOD_finish_FLAG (UINTVAL)(1 << 2) /* run async past sweep */ +#define DOD_finish_FLAG (UINTVAL)(1 << 2) /* on Parrot exit: mark (almost) all PMCs dead and */ + /* garbage collect. */ #define DOD_no_trace_volatile_roots (UINTVAL)(1 << 3) /* trace all but volatile root set, i.e. registers */ diff --git a/src/inter_create.c b/src/inter_create.c index 51c355d..307fa71 100644 --- a/src/inter_create.c +++ b/src/inter_create.c @@ -314,6 +314,14 @@ Parrot_really_destroy(PARROT_INTERP, SHIM(int exit_code), SHIM(void *arg)) */ interp->arena_base->DOD_block_level = interp->arena_base->GC_block_level = 0; + + if (Interp_trace_TEST(interp, ~0)) { + PIO_eprintf(interp, "ParrotIO objects (like stdout and stderr) are about to be closed, so clearing trace flags.\n"); + Interp_trace_CLEAR(interp, ~0); + } + + /* Destroys all PMCs, even constants and the ParrotIO objects for + * std{in,out,err}. So we better not try to be verbose about DOD'ing. */ Parrot_do_dod_run(interp, DOD_finish_FLAG); #if STM_PROFILE