linux - Child hangs if parent crashes or exits in google_breakpad::ExceptionHandler::SignalHandler -



linux - Child hangs if parent crashes or exits in google_breakpad::ExceptionHandler::SignalHandler -

this happens if parent crashes after cloning kid process, before sending unblocking byte sendcontinuesignaltochild(). in case pipe file handle remains opened , kid stays infinitely blocked on read(...) within waitforcontinuesignal(). after crash, kid adopted init process.

steps reproduce:

l. simulate parent crash in google_breakpad::exceptionhandler::generatedump(crashcontext *context):

... const pid_t kid = sys_clone( threadentry, stack, clone_files | clone_fs | clone_untraced, &thread_arg, null, null, null); int r, status; // allow kid ptrace sys_prctl(pr_set_ptracer, child, 0, 0, 0); int *ptr = 0; *ptr = 42; // <------- crash here sendcontinuesignaltochild(); ... send 1 of handled signal parent (e.g. sigsegv), above generatedump(...) method envoked. observe parent exits kid still exists, blocked on waitforcontinuesignal().

output above steps:

dmytro@db:~$ ./test & [1] 25050 dmytro@db:~$ test: started dmytro@db:~$ ps aflxw | grep test 0 1000 25050 18923 20 0 40712 2680 - r pts/37 0:13 | | \_ ./test 0 1000 25054 18923 20 0 6136 856 pipe_w s+ pts/37 0:00 | | \_ grep --color=auto test dmytro@db:~$ kill -11 25050 [1]+ segmentation fault (core dumped) ./test dmytro@db:~$ ps aflxw | grep test 0 1000 25058 18923 20 0 6136 852 pipe_w s+ pts/37 0:00 | | \_ grep --color=auto test 1 1000 25055 1687 20 0 40732 356 pipe_w s pts/37 0:00 \_ ./test

1687 init pid.

in real world crash happens in thread parallel 1 handles signal. note: issue can happen because of normal programme termination (i.e. exit(0) called in parallel thread).

tested on linux 3.3.8-2.2., mips , i686 platforms.

so, 2 questions:

is expected behavior breakpad library maintain kid alive? expectation kid should exit after parent crashes/exits. if not expected behavior, best solution finish client after parent crash/exit?

thanks in advance!

any clue on possible solution?

this can happen during shutdown crash, if crashed thread not main, , parent process exits main() in time slot, apparently it's not unlikely happen seems @ first glance.

at moment, think happening because of clone_files flag of clone() function. leads situation read() on pipe in kid not returning eof if parent process quits.

i have not yet done exam if can safely rid of flag in clone() call.

linux breakpad google-breakpad

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -