https://bugs.kde.org/show_bug.cgi?id=378494
Bug ID: 378494 Summary: Debugee terminates on any signal Product: Heaptrack Version: unspecified Platform: Other OS: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: general Assignee: m...@milianw.de Reporter: maxim.go...@gmail.com Target Milestone: --- Created attachment 104899 --> https://bugs.kde.org/attachment.cgi?id=104899&action=edit A reproducer which handles SIGTERM When running under heaptrack, a debuggee is terminated upon receiving any signal even when it handles that signal. As a result, no memory cleanup on shutdown happens and heaptrack reports false positives for memory leaks. OS: Centos 7.2 Heaptrack version: c513793b Reproduction steps: # Build ~/work/heaptrack-eval $ g++ -std=c++11 -pthread test.cpp # Interrupt by Ctrl-C ~/work/heaptrack-eval $ ./a.out Started, press Ctrl-C to abort ^CInterrupted Done. # Interrrupt by "kill -TERM `pidof a.out`" ~/work/heaptrack-eval $ ./a.out Started, press Ctrl-C to abort Interrupted Done. # Run under heaptrack and interrupt by "kill -TERM `pidof a.out`" ~/work/heaptrack-eval $ heaptrack ./a.out heaptrack output will be written to "/home/centos/work/heaptrack-eval/heaptrack.a.out.20509.gz" starting application, this might take some time... Started, press Ctrl-C to abort heaptrack stats: allocations: 2 leaked allocations: 2 temporary allocations: 0 /usr/local/bin/heaptrack: line 195: 20525 Terminated LD_PRELOAD=$LIBHEAPTRACK_PRELOAD${LD_PRELOAD:+:$LD_PRELOAD} DUMP_HEAPTRACK_OUTPUT="$pipe" "$client" "$@" Heaptrack finished! Now run the following to investigate the data: heaptrack_print "/home/centos/work/heaptrack-eval/heaptrack.a.out.20509.gz" | less # Check for leaks - `p` is not freed centos@maxim-dev7 ~/work/heaptrack-eval $ heaptrack_print -l 1 "/home/centos/work/heaptrack-eval/heaptrack.a.out.20509.gz" reading file "/home/centos/work/heaptrack-eval/heaptrack.a.out.20509.gz" - please wait, this might take some time... Debuggee command was: ./a.out Failed to read time stamp: c finished reading file, now analyzing data: MOST CALLS TO ALLOCATION FUNCTIONS 1 calls to allocation functions with 1000.00B peak consumption from main in /home/centos/work/heaptrack-eval/a.out 1 calls with 1000.00B peak consumption from: 1 calls to allocation functions with 608B peak consumption from _dl_allocate_tls in /lib64/ld-linux-x86-64.so.2 1 calls with 608B peak consumption from: __pthread_create_2_1 in /lib64/libpthread.so.0 main in /home/centos/work/heaptrack-eval/a.out PEAK MEMORY CONSUMERS WARNING - the data below is not an accurate calcuation of the total peak consumption and can easily be wrong. For an accurate overview, disable backtrace merging. 1000.00B peak memory consumed over 1 calls from main in /home/centos/work/heaptrack-eval/a.out 1000.00B consumed over 1 calls from: 608B peak memory consumed over 1 calls from _dl_allocate_tls in /lib64/ld-linux-x86-64.so.2 608B consumed over 1 calls from: __pthread_create_2_1 in /lib64/libpthread.so.0 main in /home/centos/work/heaptrack-eval/a.out MEMORY LEAKS 1000.00B leaked over 1 calls from main in /home/centos/work/heaptrack-eval/a.out 1000.00B leaked over 1 calls from: 608B leaked over 1 calls from _dl_allocate_tls in /lib64/ld-linux-x86-64.so.2 608B leaked over 1 calls from: __pthread_create_2_1 in /lib64/libpthread.so.0 main in /home/centos/work/heaptrack-eval/a.out MOST TEMPORARY ALLOCATIONS total runtime: 2.73s. bytes allocated in total (ignoring deallocations): 1.61KB (590B/s) calls to allocation functions: 2 (0/s) temporary memory allocations: 0 (0/s) peak heap memory consumption: 1.61KB peak RSS (including heaptrack overhead): 4.35MB total memory leaked: 1.61KB # Same scenario with "kill -HUP `pidof a.out`" ~/work/heaptrack-eval $ heaptrack ./a.out heaptrack output will be written to "/home/centos/work/heaptrack-eval/heaptrack.a.out.21914.gz" starting application, this might take some time... Started, press Ctrl-C to abort heaptrack stats: allocations: 2 leaked allocations: 2 temporary allocations: 0 /usr/local/bin/heaptrack: line 195: 21935 Hangup LD_PRELOAD=$LIBHEAPTRACK_PRELOAD${LD_PRELOAD:+:$LD_PRELOAD} DUMP_HEAPTRACK_OUTPUT="$pipe" "$client" "$@" Heaptrack finished! Now run the following to investigate the data: heaptrack_print "/home/centos/work/heaptrack-eval/heaptrack.a.out.21914.gz" | less -- You are receiving this mail because: You are watching all bug changes.