Bug 11205 - CCache deadlock on signal_handler
Summary: CCache deadlock on signal_handler
Status: CLOSED FIXED
Alias: None
Product: ccache
Classification: Unclassified
Component: ccache (show other bugs)
Version: 3.2.1
Hardware: x64 Linux
: P5 normal
Target Milestone: 3.2.2
Assignee: Joel Rosdahl
QA Contact: Joel Rosdahl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-08 09:49 UTC by Yechiel Levi
Modified: 2015-05-10 12:34 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yechiel Levi 2015-04-08 09:49:07 UTC
We discovered a deadlock while sending SIGTERM (ctrl C) during compiling with ccache.

Signal_handler is calling vlog while the lock is already taken.

if the signal_handler was called while the thread was during malloc we reach a deadlock.

here is a ptrace:
#0  0x0000003d846f4e6e in __lll_lock_wait_private () from /lib64/libc.so.6
#1  0x0000003d8469bf2d in _L_lock_2164 () from /lib64/libc.so.6
#2  0x0000003d8469bce7 in __tz_convert () from /lib64/libc.so.6
#3  0x0000000000408df1 in log_prefix ()
#4  0x0000000000408f19 in vlog ()
#5  0x0000000000409080 in cc_log ()
#6  0x00000000004090b3 in tmp_unlink ()
#7  0x0000000000402a48 in clean_up_pending_tmp_files ()
#8  <signal handler called>
#9  0x0000003d8469c639 in __tzfile_read () from /lib64/libc.so.6
#10 0x0000003d8469bba4 in tzset_internal () from /lib64/libc.so.6
#11 0x0000003d8469bd09 in __tz_convert () from /lib64/libc.so.6
#12 0x0000000000408df1 in log_prefix ()
#13 0x0000000000408f19 in vlog ()
#14 0x0000000000409080 in cc_log ()
#15 0x000000000040f29c in lockfile_acquire ()
#16 0x000000000040b914 in stats_flush ()
#17 0x000000000040ef36 in call_nullary_exit_function ()
#18 0x000000000040ef01 in exitfn_call ()
#19 0x0000003d84635d92 in exit () from /lib64/libc.so.6
#20 0x00000000004073bb in ccache ()
#21 0x0000000000407477 in ccache_main ()
#22 0x0000003d8461ecdd in __libc_start_main () from /lib64/libc.so.6
#23 0x0000000000402509 in _start ()

We currently workaround it by removing the cc_log in tmp_unlink.
Comment 1 Joel Rosdahl 2015-04-27 19:55:11 UTC
Fixed in 7366fc30990f4d9124c933c73f7a71ad19d06bc8 on 3.2-maint.
Comment 2 Joel Rosdahl 2015-05-10 12:34:06 UTC
Included in v3.2.2.