Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

deadlock caused by gettext usage in a signal handler



Hello,

I just had a Zsh process (using zsh-4.2.6-6.fc7) deadlock, the
backtrace seems to show it is initializing the gettext infrastructure
to print "Input/output error" in a signal handler.

As a solution, avoiding gettext() in signal handlers seems harder than
forcing gettext() initialization before its first usage, but the cost
may be prohibitive.

(gdb) bt
#0  0x0000003c3f0dcf78 in __lll_mutex_lock_wait () from /lib64/libc.so.6
#1  0x0000003c3f074ced in _L_lock_15106 () from /lib64/libc.so.6
#2  0x0000003c3f073d7b in *__GI___libc_realloc (oldmem=0x3c3f34c960, 
    bytes=2048) at malloc.c:3697
#3  0x0000003c3f02d2bc in read_alias_file (fname=<value optimized out>, 
    fname_len=<value optimized out>) at localealias.c:309
#4  0x0000003c3f02d58e in _nl_expand_alias (name=0x7fff630ad470 "fr_FR.UTF-8")
    at localealias.c:189
#5  0x0000003c3f02bdf7 in _nl_find_domain (
    dirname=0x3c3f11efb0 "/usr/share/locale", 
    locale=0x7fff630ad470 "fr_FR.UTF-8", 
    domainname=0x7fff630ad490 "LC_MESSAGES/libc.mo", domainbinding=0x0)
    at finddomain.c:120
#6  0x0000003c3f02b64f in __dcigettext (domainname=0x3c3f11b86b "libc", 
    msgid1=0x3c3f11ba3a "Input/output error", msgid2=0x0, plural=0, n=0, 
    category=5) at dcigettext.c:627
#7  0x0000003c3f07713c in *__GI___strerror_r (errnum=5, buf=0x0, buflen=0)
    at _strerror.c:65
#8  0x0000003c3f076f7e in strerror (errnum=1060424032) at strerror.c:33
#9  0x0000000000474507 in zerrmsg (fmt=<value optimized out>, str=0x0, num=5)
    at utils.c:172
#10 0x0000000000474aab in zerr (fmt=0x3c3f34c960 "\002", str=0x0, num=2064)
    at utils.c:60
#11 0x000000000043cad8 in update_job (jn=0x892140) at jobs.c:361
#12 0x0000000000465540 in zhandler (sig=17) at signals.c:521
#13 <signal handler called>
#14 0x0000003c3f030afa in *__GI___sigsuspend (set=0x7fff630adc60)
    at ../sysdeps/unix/sysv/linux/sigsuspend.c:63
#15 0x0000000000465734 in signal_suspend (sig=17, sig2=0) at signals.c:367
#16 0x000000000043c74c in zwaitjob (job=<value optimized out>, sig=0)
    at jobs.c:1145
#17 0x000000000043c8f8 in waitjobs () at jobs.c:1180
#18 0x0000000000425de2 in execpline (state=<value optimized out>, 
    slcode=<value optimized out>, how=18, last1=0) at exec.c:1146
#19 0x0000000000426a70 in execlist (state=0x7fff630adfb0, dont_change_job=0, 
    exiting=0) at exec.c:877
#20 0x0000000000426c85 in execode (p=0x2aaaae93b338, dont_change_job=0, 
    exiting=0) at exec.c:777
#21 0x000000000043738f in loop (toplevel=0, justonce=0) at init.c:167
#22 0x000000000043794c in source (s=0x4780af "/etc/zlogout") at init.c:1045
#23 0x000000000040ddb6 in zexit (val=1, from_where=0) at builtin.c:4187
#24 0x0000000000465637 in zhandler (sig=-4) at signals.c:540
#25 <signal handler called>
#26 0x0000003c3f097642 in __libc_fork ()
    at ../nptl/sysdeps/unix/sysv/linux/fork.c:127
#27 0x0000000000421e85 in zfork (tv=0x7fff630aea90) at exec.c:231
#28 0x00000000004239b1 in execcmd (state=0x7fff630afc80, input=0, output=0, 
    how=18, last1=2) at exec.c:2127
#29 0x0000000000425557 in execpline2 (state=0x7fff630afc80, 
    pcode=<value optimized out>, how=18, input=0, output=0, last1=0)
    at exec.c:1285
#30 0x00000000004259ea in execpline (state=0x7fff630afc80, 
    slcode=<value optimized out>, how=18, last1=0) at exec.c:1071
#31 0x0000000000426a70 in execlist (state=0x7fff630afc80, dont_change_job=0, 
    exiting=0) at exec.c:877
#32 0x0000000000426c85 in execode (p=0x2aaaae93b1a0, dont_change_job=0, 
    exiting=0) at exec.c:777
#33 0x000000000043738f in loop (toplevel=1, justonce=0) at init.c:167
#34 0x0000000000438051 in zsh_main (argc=<value optimized out>, 
    argv=0x7fff630afdf8) at init.c:1280
#35 0x0000003c3f01dab4 in __libc_start_main (main=0x40cca0 <main>, argc=1, 
    ubp_av=0x7fff630afdf8, init=<value optimized out>, 
    fini=<value optimized out>, rtld_fini=<value optimized out>, 
    stack_end=0x7fff630afde8) at libc-start.c:222
#36 0x000000000040cc09 in _start ()

Thanks.

-- 
Guillaume



Messages sorted by: Reverse Date, Date, Thread, Author