From f7182e7a5cbf75954f713c7e447c75eeb935b4dc Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 26 Mar 2016 12:31:08 -0600 Subject: [PATCH] GC on Linux: adjust handler to not abort on SI_KERNEL signals The meaning of SI_KERNEL signals is not clear, but ignoring them seems to let the process continue ok. (These signals show up when running `typed-racket-test/main --int`.) --- racket/src/racket/gc2/sighand.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/racket/src/racket/gc2/sighand.c b/racket/src/racket/gc2/sighand.c index f92e7063ab..0b27af3423 100644 --- a/racket/src/racket/gc2/sighand.c +++ b/racket/src/racket/gc2/sighand.c @@ -78,20 +78,22 @@ void fault_handler(int sn, siginfo_t *si, void *ctx) */ } if (c == 0) { - /* I have no idea why this happens on linux */ - /* supposedly its coming from the user via kill */ - /* so just ignore it. It appears when */ - /* running w/ places in GDB */ - printf("SIGSEGV SI_USER SI_ERRNO %i fault on addr %p\n", si->si_errno, p); -#ifdef MZ_USE_PLACES - printf("pid %i uid %i thread %lx\n", si->si_pid, si->si_uid, mz_proc_os_thread_self()); -#else - printf("pid %i uid %i\n", si->si_pid, si->si_uid); -#endif + /* When running w/ places in gdb, the debugger + sometimes propagates extra copies of signals + that crash the process. Ignore them (but they're + rare enough that it's worth reporting that the signal + was received). */ + printf("Signal as SI_USER (from debugger?) - ignoring\n"); return; } if (c == 128) { - printf("SIGSEGV SI_KERNEL SI_ERRNO %i fault on addr %p\n", si->si_errno, p); + /* A mysterious signal on Linux, probably the OS providing some + kind of alert. These can be frequent enough that printing + an alert is too noisy. */ + if (0) { + printf("Signal as SI_KERNEL - ignoring\n"); + } + return; } #if WAIT_FOR_GDB launchgdb();