zsh-workers
 help / color / mirror / code / Atom feed
* deadlock caused by gettext usage in a signal handler
@ 2007-11-30 19:35 Guillaume Chazarain
  2007-12-03 22:43 ` Peter Stephenson
  2007-12-04 20:30 ` Peter Stephenson
  0 siblings, 2 replies; 20+ messages in thread
From: Guillaume Chazarain @ 2007-11-30 19:35 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: deadlock caused by gettext usage in a signal handler
@ 2007-12-10  0:11 Paul Ackersviller
  2007-12-10  2:04 ` Bart Schaefer
  0 siblings, 1 reply; 20+ messages in thread
From: Paul Ackersviller @ 2007-12-10  0:11 UTC (permalink / raw)
  To: zsh-workers; +Cc: Guillaume Chazarain

Peter Stephenson wrote:
> Guillaume Chazarain wrote:
> > Thanks, how about reverting the strerror_r one (also in zsh-4.2)?
> 
> That's probably neater, given the hack to get it to work.  However, it's
> marginally neater to keep the errmsg variable.  It makes it look like
> I've done something.

I've done 24180 on the 4.2 branch, and also added 24169, 24170,
24174, 24187, and 24188.


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-12-10  3:17 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-30 19:35 deadlock caused by gettext usage in a signal handler Guillaume Chazarain
2007-12-03 22:43 ` Peter Stephenson
2007-12-04  1:39   ` Paul Ackersviller
2007-12-04 18:02   ` Guillaume Chazarain
2007-12-04 18:24     ` Peter Stephenson
2007-12-04 18:43       ` Guillaume Chazarain
2007-12-04 19:43         ` Peter Stephenson
2007-12-04 19:49           ` Guillaume Chazarain
2007-12-04 20:30 ` Peter Stephenson
2007-12-04 23:09   ` Guillaume Chazarain
2007-12-06 23:02   ` Guillaume Chazarain
2007-12-07 10:35     ` Peter Stephenson
2007-12-07 10:46       ` Guillaume Chazarain
2007-12-07 11:21         ` Bart Schaefer
2007-12-07 11:27           ` Peter Stephenson
2007-12-07 11:57             ` Guillaume Chazarain
2007-12-07 11:29         ` Peter Stephenson
2007-12-10  0:11 Paul Ackersviller
2007-12-10  2:04 ` Bart Schaefer
2007-12-10  3:17   ` Paul Ackersviller

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).