zsh-workers
 help / color / mirror / code / Atom feed
* Deadlock when receiving kill-signal from child process
@ 2015-08-03 11:25 Mathias Fredriksson
  2015-08-03 15:52 ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-03 11:25 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]

On OSX 10.10 using ZSH 5.0.5 (OSX), 5.0.7 and 5.0.8 (Homebrew) I am able to
trigger a deadlock of zsh when sending a kill-signal from a child process
to a parent process. This is reproducible with almost all kill signals
(KILL, INT, ALRM, etc). WINCH is the only signal that has proved to be
unaffected.

This is not just OSX specific either. Multiple systems seem affected (e.g.
Ubuntu, Xubuntu, Arch Linux) as can be seen from this (very likely related)
issue[1]. Weirdly not all systems or configurations seem affected.

I've tried to debug this myself (attached debug output) but I'm not very
comfortable around such tools. Sorry if this has been reported/fixed
already.

Sample code to reproduce blow. Note: it does not always trigger a deadlock,
it might take a couple of runs and it probably depends on the system
running it.

[1] https://github.com/sorin-ionescu/prezto/issues/888

--

child() {
    sleep 0.1
    kill -USR1 $$
}

TRAPUSR1() {
    print -n "."
}

for i in {1..99}; do
    child &!
done

for i in {1..100}; do
    sleep 0.00001
done

[-- Attachment #1.2: Type: text/html, Size: 1538 bytes --]

[-- Attachment #2: zsh_deadlock.out --]
[-- Type: application/octet-stream, Size: 38288 bytes --]

93100/0x76ed6:  251554415       5      2 kill(0x16BB9, 0x0, 0x1)         = 0 0
93100/0x76ed6:  251554417       3      1 read(0xB, "\0", 0x1)        = -1 Err#35
93100/0x76ed6:  251554422       2      0 sigprocmask(0x1, 0x7FFF5149726C, 0x7FFF51497268)        = 0x0 0
93100/0x76ed6:  251554423       2      0 sigprocmask(0x2, 0x7FFF5149726C, 0x7FFF51497268)        = 0x0 0
93100/0x76ed6:  251554425       2      0 sigprocmask(0x1, 0x7FFF51499F8C, 0x7FFF51499F88)        = 0x0 0
93100/0x76ed6:  251554426       2      0 sigprocmask(0x2, 0x7FFF51499F8C, 0x7FFF51499F88)        = 0x0 0
93100/0x76ed6:  251554429       2      0 sigprocmask(0x1, 0x7FFF51499F8C, 0x7FFF51499F88)        = 0x0 0
93100/0x76ed6:  251554431       2      0 sigprocmask(0x1, 0x7FFF51499F8C, 0x7FFF51499F88)        = 0x0 0
93100/0x76ed6:  251554432       2      0 sigprocmask(0x2, 0x7FFF51499F8C, 0x7FFF51499F88)        = 0x0 0
93100/0x76ed6:  251554454       2      0 sigprocmask(0x1, 0x7FFF5149CF1C, 0x7FFF5149CF18)        = 0x0 0
93100/0x76ed6:  251554458       2      0 sigprocmask(0x1, 0x7FFF5149CF1C, 0x7FFF5149CF18)        = 0x0 0
93100/0x76ed6:  251554459       3      0 sigprocmask(0x2, 0x7FFF5149CF1C, 0x7FFF5149CF18)        = 0x0 0
93100/0x76ed6:  251554475       2      0 sigprocmask(0x3, 0x7FFF514A00FC, 0x7FFF514A00F8)        = 0x0 0
93100/0x76ed6:  251554480       7      4 close(0x4)      = 0 0
93100/0x76ed6:  251554482       3      1 read(0x3, "\0", 0x1)        = 0 0
93100/0x76ed6:  251554485       3      2 close(0x3)      = 0 0
93100/0x76ed6:  251554487       2      0 sigprocmask(0x1, 0x7FFF514A2C4C, 0x7FFF514A2C48)        = 0x0 0
97243/0x79833:       124  275358 18446744073708459 thread_selfid(0x0, 0x7FFF5148596C, 0x7FFF51485968)        = 497715 0
97239/0x7982f:       916       7      3 write_nocancel(0x1, "**[[DIRPATH_REMOVED]]**\n\0", 0x39)        = 57 0
97239/0x7982f:       925       3      0 sigprocmask(0x1, 0x7FFF5147C54C, 0x7FFF5147C548)         = 0x0 0
97239/0x7982f:       926       3      0 sigprocmask(0x2, 0x7FFF5147C54C, 0x7FFF5147C548)         = 0x0 0
97239/0x7982f:       931       5      3 close(0x1)       = 0 0
93100/0x76ed6:  251292614       4      0 sigprocmask(0x3, 0x7FFF51482154, 0x7FFF51482150)        = 0x0 0
93100/0x76ed6:  251292619       6      3 wait4_nocancel(0xFFFFFFFF, 0x7FFF51482114, 0x13)        = 97238 0
93100/0x76ed6:  251292629      12      9 getrusage(0xFFFFFFFF, 0x10E7D1778, 0x13)        = 0 0
93100/0x76ed6:  251292630       2      0 wait4_nocancel(0xFFFFFFFF, 0x7FFF51482114, 0x13)        = 0 0
93100/0x76ed6:  251292632       3      1 sigreturn(0x7FFF51482600, 0x1E, 0x13)       = 0 Err#-2
93100/0x76ed6:  251292635       2      0 sigprocmask(0x1, 0x7FFF514826CC, 0x7FFF514826C8)        = 0x0 0
93100/0x76ed6:  251292636       2      0 kill(0x17BD6, 0x0, 0x1)         = -1 Err#3
93100/0x76ed6:  251292637       2      0 sigprocmask(0x2, 0x7FFF514826CC, 0x7FFF514826C8)        = 0x0 0
93100/0x76ed6:  251292753       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293544       3      0 sigprocmask(0x1, 0x7FFF5147CE3C, 0x7FFF5147CE38)        = 0x0 0
93100/0x76ed6:  251293545       2      0 sigprocmask(0x2, 0x7FFF5147CE3C, 0x7FFF5147CE38)        = 0x0 0
93100/0x76ed6:  251293555       2      0 sigprocmask(0x1, 0x7FFF5147FB4C, 0x7FFF5147FB48)        = 0x0 0
93100/0x76ed6:  251293555       2      0 sigprocmask(0x2, 0x7FFF5147FB4C, 0x7FFF5147FB48)        = 0x0 0
93100/0x76ed6:  251293557       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293558       2      0 sigprocmask(0x2, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293558       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293572       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293573       2      0 sigprocmask(0x2, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293573       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293578       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293579       2      0 sigprocmask(0x2, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293579       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293582       2      0 sigprocmask(0x1, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293583       2      0 sigprocmask(0x2, 0x7FFF514828BC, 0x7FFF514828B8)        = 0x0 0
93100/0x76ed6:  251293600       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293602       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293603       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293635       2      0 sigprocmask(0x1, 0x7FFF514887DC, 0x7FFF514887D8)        = 0x0 0
93100/0x76ed6:  251293640       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293644       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293645       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293646       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293649       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293650       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293650       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293654       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293655       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293660       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293667       2      0 sigprocmask(0x1, 0x7FFF51482ADC, 0x7FFF51482AD8)        = 0x0 0
93100/0x76ed6:  251293680       2      0 sigprocmask(0x1, 0x7FFF51482ADC, 0x7FFF51482AD8)        = 0x0 0
93100/0x76ed6:  251293681       2      0 sigprocmask(0x2, 0x7FFF51482ADC, 0x7FFF51482AD8)        = 0x0 0
93100/0x76ed6:  251293682       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293683       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293683       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293686       2      0 sigprocmask(0x1, 0x7FFF51482B3C, 0x7FFF51482B38)        = 0x0 0
93100/0x76ed6:  251293696       2      0 sigprocmask(0x1, 0x7FFF51482B3C, 0x7FFF51482B38)        = 0x0 0
93100/0x76ed6:  251293697       2      0 sigprocmask(0x2, 0x7FFF51482B3C, 0x7FFF51482B38)        = 0x0 0
93100/0x76ed6:  251293698       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293698       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293699       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293701       2      0 sigprocmask(0x1, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293701       2      0 sigprocmask(0x2, 0x7FFF5148584C, 0x7FFF51485848)        = 0x0 0
93100/0x76ed6:  251293708       2      0 sigprocmask(0x1, 0x7FFF514887DC, 0x7FFF514887D8)        = 0x0 0
93100/0x76ed6:  251293709       2      0 sigprocmask(0x1, 0x7FFF514887DC, 0x7FFF514887D8)        = 0x0 0
93100/0x76ed6:  251293710       2      0 sigprocmask(0x2, 0x7FFF514887DC, 0x7FFF514887D8)        = 0x0 0
93100/0x76ed6:  251293749       2      0 sigprocmask(0x1, 0x7FFF5148B76C, 0x7FFF5148B768)        = 0x0 0
93100/0x76ed6:  251293763       7      4 pipe(0x1, 0x7FFF5148B76C, 0x7FFF5148B768)       = 5 0
93100/0x76ed6:  251293765       3      1 fcntl(0x5, 0x0, 0xA)        = 12 0
93100/0x76ed6:  251293766       2      0 close(0x5)      = 0 0
93100/0x76ed6:  251293767       2      0 fcntl(0x6, 0x0, 0xA)        = 13 0
93100/0x76ed6:  251293768       1      0 close(0x6)      = 0 0
93100/0x76ed6:  251293768       2      0 sigprocmask(0x1, 0x7FFF51488A9C, 0x7FFF51488A98)        = 0x0 0
93100/0x76ed6:  251423166      10      2 close(0xD)      = 0 0
93100/0x76ed6:  251423169       6      1 fcntl_nocancel(0xC, 0x3, 0x0)       = 0 0
93100/0x76ed6:  251423215       7      2 fstat64(0xC, 0x7FFF514888D8, 0x0)       = 0 0
93100/0x76ed6:  251553878      10      1 close(0xD)      = 0 0
93100/0x76ed6:  251553881       5      1 fcntl_nocancel(0xC, 0x3, 0x0)       = 0 0
93100/0x76ed6:  251553922       7      2 fstat64(0xC, 0x7FFF514888D8, 0x0)       = 0 0
97242/0x79832:       391       7      1 sigprocmask(0x2, 0x7FFF51488A9C, 0x7FFF51488A98)         = 0x0 0
97242/0x79832:       409       5      1 close(0xC)       = 0 0
97242/0x79832:       413       6      2 dup2(0xD, 0x1, 0x7FFF51488A98)       = 1 0
97242/0x79832:       414       3      0 close(0xD)       = 0 0
97242/0x79832:       449       4      0 sigaction(0xE, 0x7FFF51488968, 0x7FFF51488990)       = 0 0
97242/0x79832:       453       3      0 sigaction(0x16, 0x7FFF51488A18, 0x7FFF51488A40)      = 0 0
97242/0x79832:       454       3      0 sigaction(0x15, 0x7FFF51488A18, 0x7FFF51488A40)      = 0 0
97242/0x79832:       455       3      0 sigaction(0x12, 0x7FFF51488A18, 0x7FFF51488A40)      = 0 0
97242/0x79832:       456       3      0 sigaction(0xF, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97242/0x79832:       457       3      0 sigaction(0x2, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97242/0x79832:       458       3      0 sigaction(0xD, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97242/0x79832:       458       3      0 sigaction(0x3, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97242/0x79832:       494       4      0 getrusage(0xFFFFFFFF, 0x10E7D1778, 0x7FFF51488A40)       = 0 0
97242/0x79832:       522       4      0 sigprocmask(0x1, 0x7FFF514888FC, 0x7FFF514888F8)         = 0x0 0
97238/0x7982e:    132647  131937 131767 fork()       = 97239 0
97238/0x7982e:    132714       6      1 close(0xD)       = 0 0
97238/0x7982e:    132717       5      1 fcntl_nocancel(0xC, 0x3, 0x0)        = 0 0
97238/0x7982e:    132738       5      1 fstat64(0xC, 0x7FFF5147C528, 0x0)        = 0 0
97238/0x7982e:    132770     828     12 read_nocancel(0xC, "**[[DIRPATH_REMOVED]]**\n\0", 0x4000)       = 57 0
97238/0x7982e:    132780      18      3 read_nocancel(0xC, "\0", 0x4000)         = 0 0
97238/0x7982e:    132785       7      3 close_nocancel(0xC)      = 0 0
97238/0x7982e:    132799       4      0 sigprocmask(0x1, 0x7FFF5147C69C, 0x7FFF5147C698)         = 0x0 0
97238/0x7982e:    132801       3      0 kill(0x17BD7, 0x0, 0x1)      = 0 0
97238/0x7982e:    132806     131      3 sigsuspend(0x2, 0x0, 0x1)        = -1 Err#4
97238/0x7982e:    132820       6      3 sigprocmask(0x1, 0x7FFF5147C124, 0x7FFF5147C120)         = 0x0 0
97240/0x79830:       474       7      1 sigprocmask(0x2, 0x7FFF51488A9C, 0x7FFF51488A98)         = 0x0 0
97240/0x79830:       491       5      1 close(0xC)       = 0 0
97240/0x79830:       494       6      2 dup2(0xD, 0x1, 0x7FFF51488A98)       = 1 0
97240/0x79830:       495       3      0 close(0xD)       = 0 0
97240/0x79830:       522       5      1 sigaction(0xE, 0x7FFF51488968, 0x7FFF51488990)       = 0 0
97240/0x79830:       532       3      0 sigaction(0x16, 0x7FFF51488A18, 0x7FFF51488A40)      = 0 0
97240/0x79830:       533       3      0 sigaction(0x15, 0x7FFF51488A18, 0x7FFF51488A40)      = 0 0
97240/0x79830:       534       3      0 sigaction(0x12, 0x7FFF51488A18, 0x7FFF51488A40)      = 0 0
97240/0x79830:       535       3      0 sigaction(0xF, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97240/0x79830:       535       3      0 sigaction(0x2, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97240/0x79830:       536       3      0 sigaction(0xD, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97240/0x79830:       537       3      0 sigaction(0x3, 0x7FFF51488A18, 0x7FFF51488A40)       = 0 0
97240/0x79830:       554       5      0 getrusage(0xFFFFFFFF, 0x10E7D1778, 0x7FFF51488A40)       = 0 0
97240/0x79830:       584       4      0 sigprocmask(0x1, 0x7FFF514888FC, 0x7FFF514888F8)         = 0x0 0
97240/0x79830:       700       4      0 sigprocmask(0x1, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97240/0x79830:       807       4      0 sigprocmask(0x1, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97240/0x79830:       809       3      0 sigprocmask(0x2, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97240/0x79830:       834       4      0 sigprocmask(0x1, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97240/0x79830:       854      10      4 write_nocancel(0x1, "%F{cyan}%T \n\0", 0xC)      = 12 0
97240/0x79830:       856       3      0 sigprocmask(0x1, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97240/0x79830:       857       3      0 sigprocmask(0x2, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97240/0x79830:       945       9      5 close(0x1)       = 0 0
97242/0x79832:       691      71      6 sigprocmask(0x1, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97242/0x79832:       964      38     32 access("/etc/localtime\0", 0x4, 0x7FFF51485968)      = 0 0
97242/0x79832:       993      31     25 open_nocancel("/etc/localtime\0", 0x0, 0x0)      = 5 0
97242/0x79832:       996       5      2 fstat64(0x5, 0x7FFF5147EEE0, 0x0)        = 0 0
97242/0x79832:      1004      12      7 read_nocancel(0x5, "TZif\0", 0x2A64)         = 682 0
97242/0x79832:      1007       7      2 close_nocancel(0x5)      = 0 0
97242/0x79832:      1125       8      3 write_nocancel(0x1, "66\n\0", 0x3)       = 3 0
97242/0x79832:      1128       3      0 sigprocmask(0x1, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97242/0x79832:      1129       3      0 sigprocmask(0x2, 0x7FFF5148596C, 0x7FFF51485968)         = 0x0 0
97242/0x79832:      1179       6      3 close(0x1)       = 0 0
93100/0x76ed6:  251553995    1911     71 read_nocancel(0xC, "66\n\0", 0x4000)        = 3 0
93100/0x76ed6:  251554000       4      1 read_nocancel(0xC, "\0", 0x4000)        = 0 0
93100/0x76ed6:  251554004       6      3 close_nocancel(0xC)         = 0 0
93100/0x76ed6:  251554019       4      0 sigprocmask(0x1, 0x7FFF51488A4C, 0x7FFF51488A48)        = 0x0 0
93100/0x76ed6:  251554021       3      1 kill(0x17BDA, 0x0, 0x1)         = 0 0
kill -ALRM
93100/0x76ed6:  251554493 35458225056      4 sigsuspend(0x2, 0x7FFF514A2C4C, 0x7FFF514A2C48)         = -1 Err#4
93100/0x76ed6:  251554503      87      2 sigprocmask(0x1, 0x7FFF514A26D4, 0x7FFF514A26D0)        = 0x0 0
93100/0x76ed6:  251554504       4      0 sigprocmask(0x3, 0x7FFF514A26D4, 0x7FFF514A26D0)        = 0x0 0
93100/0x76ed6:  251554509       6      2 sigreturn(0x7FFF514A2B80, 0x1E, 0x7FFF514A26D0)         = 0 Err#-2
93100/0x76ed6:  251554512       3      0 sigprocmask(0x1, 0x7FFF514A2C4C, 0x7FFF514A2C48)        = 0x0 0
kill -9
   18/0xaf052:        21      86      0 thread_selfid(0x0, 0x0, 0x0)         = 716882 0
   18/0xaf052:        60      10      3 stack_snapshot(0x0, 0x7FCE84022000, 0x10000)         = 14745 0
   18/0xaf052:        84      10      4 kevent64(0x3, 0x101DCFD58, 0x1)      = 1 0
93114/0x76ee4:      3671 35541264647     13 read(0x0, "\0", 0x4000)      = -1 Err#4
16491/0xaf055:         9  422732 18446744067692683 thread_selfid(0x1, 0x7FFF5149C1C4, 0x7FFF5149C1C0)        = 716885 0
93100/0x76ed6:  251554517 63356186      4 sigsuspend(0x2, 0x7FFF514A2C4C, 0x7FFF514A2C48)        = -1 Err#4
93113/0x76ee3:   6016792 35541212127     11 read(0x0, "\0", 0x1)         = -1 Err#4
93113/0x76ee3:   6016801      79      1 sigprocmask(0x1, 0x7FFF5149C1C4, 0x7FFF5149C1C0)         = 0x0 0
93113/0x76ee3:   6016803       3      0 sigprocmask(0x3, 0x7FFF5149C1C4, 0x7FFF5149C1C0)         = 0x0 0
   18/0xaf052:        97      69      0 __disable_threadsignal(0x1, 0x0, 0x0)        = 0 0
  394/0xaf0b0:        19     100      0 thread_selfid(0x0, 0x0, 0x0)         = 716976 0
  394/0xaf0b0:        51      31     25 read(0xE, "\2613-|7\342\226a\266J\340\034\0", 0x40)      = 64 0
  394/0xaf0b0:        67      10      3 bsdthread_ctl(0x400, 0x182BF, 0x800)         = 0 0
  394/0xaf0b0:        94      75     12 read(0xE, "r\317\207\332\253\263\255\236\001\331\340\253\304\003\020<\234\251^O\376\326\373\016\225\215\321\005`\261\357\233\255\023\271#hd\265m'\254\v\321\305K\005\2572c\337\352\2252=\304\274\027\002Z\016M\t\017\0", 0x40)       = 64 0
  394/0xaf0b0:       109       7      1 bsdthread_ctl(0x400, 0x182BF, 0x800)         = 0 0
  394/0xaf0b0:       128      12      9 read(0xE, "\335@N\247\324\364\321\n\264XbQK\312\333g\030\346,|X\327\020b(\361\241\335$4S\314\275]\023\257\312\310\025\327\364\375\222q`\325\033\214\"\365>*\022e\344\027\354\326>X@ \377\027\0", 0x40 = 64 0
  394/0xaf0b0:       165       9      1 read(0x12, "\0", 0x8000)         = -1 Err#35
  394/0xaf0b0:       206       5      0 read(0x12, "\0", 0x8000)         = -1 Err#35
  394/0xaf0b0:       283      75      0 __disable_threadsignal(0x1, 0x0, 0x0)        = 0 0
  336/0xaf114:        15      88      1 thread_selfid(0x0, 0x0, 0x0)         = 717076 0
  336/0xaf114:        33       6      1 kevent64(0x3, 0x107CDBDF8, 0x1)      = 1 0
  336/0xaf114:        41      76      0 __disable_threadsignal(0x1, 0x0, 0x0)        = 0 0
   79/0xaf164:        46     105      1 bsdthread_ctl(0x100, 0x8FF, 0x7123)      = 0 0
   79/0xaf164:        52       4      0 bsdthread_ctl(0x100, 0x8FF, 0x0)         = 0 0
   79/0xaf164:        14      80      1 thread_selfid(0x0, 0x0, 0x0)         = 717156 0
   79/0xaf164:        19       4      0 bsdthread_ctl(0x100, 0x8FF, 0x7123)      = 0 0
   79/0xaf164:        36      11      8 workq_kernreturn(0x20, 0x0, 0x1)         = 0 0
   79/0xaf164:        37       3      0 bsdthread_ctl(0x100, 0x8FF, 0x0)         = 0 0
   79/0xaf164:        60      92      2 bsdthread_ctl(0x100, 0x8FF, 0x7123)      = 0 0
   79/0xaf164:        63       3      0 bsdthread_ctl(0x100, 0x8FF, 0x0)         = 0 0
   79/0xaf164:        97      67      2 bsdthread_ctl(0x100, 0x8FF, 0x7A57)      = 0 0
   79/0xaf164:       753       4      0 bsdthread_ctl(0x100, 0x8FF, 0x0)         = 0 0
   79/0xaf164:        74      79      1 bsdthread_ctl(0x100, 0x8FF, 0xA21B)      = 0 0
   79/0xaf164:        87       7      3 workq_kernreturn(0x20, 0x0, 0x1)         = 0 0
   79/0xaf164:        89       4      0 bsdthread_ctl(0x100, 0x8FF, 0x0)         = 0 0
   79/0xaf164:       764       9      0 bsdthread_ctl(0x100, 0x8FF, 0xA22B)      = 0 0
   79/0xaf164:       779      71      3 workq_kernreturn(0x20, 0x0, 0x1)         = 0 0
   79/0xaf164:       781       4      0 bsdthread_ctl(0x100, 0x8FF, 0x0)         = 0 0
  643/0xaf19c:        17      54      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf19c:        21       6      2 psynch_cvsignal(0x600000161948, 0x100, 0x0)      = 257 0
  643/0xaf19c:        25       7      2 psynch_mutexdrop(0x600000161908, 0x303, 0x200)       = 0 0
  643/0xaf19c:        28       3      0 __pthread_canceled(0x1, 0x303, 0x200)        = 0 0
  643/0xaf19c:        29       2      0 __pthread_canceled(0x2, 0x303, 0x200)        = 0 0
  643/0xaf19c:        36       9      6 socket(0x2, 0x2, 0x0)        = 15 0
  643/0xaf19c:        38       3      1 fcntl(0xF, 0x4, 0x4)         = 0 0
  643/0xaf19c:        39       3      1 setsockopt(0xF, 0xFFFF, 0x20)        = 0 0
  643/0xaf19c:        66      29     26 sendto(0xF, 0x10000AD00, 0x10)       = 16 0
  643/0xaf19c:        68       3      0 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf19c:        73      53      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
   79/0xaf164:       823     125      1 __disable_threadsignal(0x1, 0x0, 0x0)        = 0 0
  643/0xaf19c:         7      10      1 thread_selfid(0x0, 0x0, 0x0)         = 717212 0
  643/0xaf19c:        86 1004030     11 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf19c:        91      54      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:        92       2      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       104 1004911     11 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf19c:       110      53      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       111       2      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       118 1003943      6 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf19c:       121      53      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       122       2      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       127 1003585      5 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf19c:       130      86      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       131       4      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       139 1004688      7 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf19c:       144      93      1 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       149      50      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf19c:       161 1003412      9 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf19c:       166      94      1 shutdown(0xF, 0x2, 0x0)      = -1 Err#57
  643/0xaf19c:       176      14      8 close(0xF)       = 0 0
  643/0xaf1e3:         8      58      0 thread_selfid(0x0, 0x0, 0x0)         = 717283 0
  643/0xaf1e3:        13       4      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf1e3:        18       6      3 psynch_cvsignal(0x600000160748, 0x100, 0x0)      = 257 0
  643/0xaf1e3:        22       2      0 __pthread_canceled(0x1, 0x100, 0x0)      = 0 0
  643/0xaf1e3:        22       2      0 __pthread_canceled(0x2, 0x100, 0x0)      = 0 0
  643/0xaf1e3:        28       8      5 socket(0x2, 0x2, 0x0)        = 14 0
  643/0xaf1e3:        31       5      2 fcntl(0xE, 0x4, 0x4)         = 0 0
  643/0xaf1e3:        35       6      2 setsockopt(0xE, 0xFFFF, 0x20)        = 0 0
  643/0xaf1e3:        81      50     45 sendto(0xE, 0x10000AD00, 0x10)       = 16 0
  643/0xaf1e3:        84       3      0 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf1e3:        84       3      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
  643/0xaf19c:       183 1004331      6 __semwait_signal(0xD07, 0x0, 0x1)        = -1 Err#60
  643/0xaf19c:       194      94      1 __disable_threadsignal(0x1, 0x0, 0x1)        = 0 0
  643/0xaf1e3:        94 1002400      9 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1e3:        99      80      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       101       6      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       115 1001195     12 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1e3:       119      65      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       120       3      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       155      63      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       156       3      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       145 1004925     24 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1e3:       180 1004109     22 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1e3:       185      53      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       186       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       248      52      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       225 1004682     38 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1e3:       240     188     10 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1e3:       261 1002730     11 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1e3:       266      81      1 shutdown(0xE, 0x2, 0x0)      = -1 Err#57
  643/0xaf1e3:       270       6      3 close(0xE)       = 0 0
  643/0xaf1ed:        77      63      0 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf1ed:        78       2      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
  643/0xaf1e3:       310      57      2 __disable_threadsignal(0x1, 0x0, 0x1)        = 0 0
  643/0xaf1ed:         6      55      0 thread_selfid(0x0, 0x0, 0x0)         = 717293 0
  643/0xaf1ed:        10       3      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf1ed:        14       6      2 psynch_cvsignal(0x608000160F88, 0x100, 0x0)      = 257 0
  643/0xaf1ed:        16       2      0 __pthread_canceled(0x1, 0x100, 0x0)      = 0 0
  643/0xaf1ed:        17       2      0 __pthread_canceled(0x2, 0x100, 0x0)      = 0 0
  643/0xaf1ed:        21       6      4 socket(0x2, 0x2, 0x0)        = 14 0
  643/0xaf1ed:        24       4      1 fcntl(0xE, 0x4, 0x4)         = 0 0
  643/0xaf1ed:        27       6      2 setsockopt(0xE, 0xFFFF, 0x20)        = 0 0
  643/0xaf1ed:        73      48     44 sendto(0xE, 0x10000AD00, 0x10)       = 16 0
  643/0xaf1e3:       293 1004823     22 __semwait_signal(0xD07, 0x0, 0x1)        = -1 Err#60
  643/0xaf1ed:        85 1003630      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1ed:        87      53      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:        88       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:        97 1004027      7 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1ed:       101      92      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       102       4      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       109 1004818      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1ed:       112      54      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       113       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       119 1003729      5 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1ed:       122      75      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       123       5      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       132 1004609      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1ed:       134      53      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       135       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf1ed:       146 1004204     10 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf1ed:       154      54      1 shutdown(0xE, 0x2, 0x0)      = -1 Err#57
  643/0xaf1ed:       160       8      5 close(0xE)       = 0 0
  643/0xaf22d:        12      95      1 thread_selfid(0x0, 0x0, 0x0)         = 717357 0
  643/0xaf22d:        18       4      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf22d:        24       8      3 psynch_cvsignal(0x600000160748, 0x100, 0x0)      = 257 0
  643/0xaf22d:        27       3      0 __pthread_canceled(0x1, 0x100, 0x0)      = 0 0
  643/0xaf22d:        28       3      0 __pthread_canceled(0x2, 0x100, 0x0)      = 0 0
  643/0xaf22d:        36      11      7 socket(0x2, 0x2, 0x0)        = 14 0
  643/0xaf22d:        39       6      2 fcntl(0xE, 0x4, 0x4)         = 0 0
  643/0xaf22d:        43       7      3 setsockopt(0xE, 0xFFFF, 0x20)        = 0 0
  643/0xaf22d:        87      46     42 sendto(0xE, 0x10000AD00, 0x10)       = 16 0
  643/0xaf22d:        99       4      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
  643/0xaf1ed:       166 1002886      5 __semwait_signal(0xD07, 0x0, 0x1)        = -1 Err#60
  643/0xaf1ed:       177      57      2 __disable_threadsignal(0x1, 0x0, 0x1)        = 0 0
  643/0xaf22d:        95       9      1 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf22d:       113 1004298     12 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf22d:       121      54      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       122       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       133 1000804     10 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf22d:       142     100      3 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       152      88      1 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       168 1002433     14 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf22d:       180      87      1 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       182       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       207 1004819     24 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf22d:       213      54      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       214       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       241      86      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       243       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf22d:       226 1003847     10 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf22d:       255 1003744     11 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf22d:       262      91      1 shutdown(0xE, 0x2, 0x0)      = -1 Err#57
  643/0xaf22d:       272      14      9 close(0xE)       = 0 0
  643/0xaf22d:       281 1004776      6 __semwait_signal(0xD07, 0x0, 0x1)        = -1 Err#60
  643/0xaf22d:       291      93      0 __disable_threadsignal(0x1, 0x0, 0x1)        = 0 0
  643/0xaf247:         7      69      0 thread_selfid(0x0, 0x0, 0x0)         = 717383 0
  643/0xaf247:        13       3      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf247:        17       6      2 psynch_cvsignal(0x600000161948, 0x100, 0x0)      = 257 0
  643/0xaf247:        20       6      2 psynch_mutexdrop(0x600000161908, 0x303, 0x200)       = 0 0
  643/0xaf247:        23       3      0 __pthread_canceled(0x1, 0x303, 0x200)        = 0 0
  643/0xaf247:        23       2      0 __pthread_canceled(0x2, 0x303, 0x200)        = 0 0
  643/0xaf247:        30       8      6 socket(0x2, 0x2, 0x0)        = 15 0
  643/0xaf247:        32       4      1 fcntl(0xF, 0x4, 0x4)         = 0 0
  643/0xaf247:        34       3      1 setsockopt(0xF, 0xFFFF, 0x20)        = 0 0
  643/0xaf247:        62      31     28 sendto(0xF, 0x10000AD00, 0x10)       = 16 0
  643/0xaf247:        64       3      0 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf247:        65       4      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
  643/0xaf247:        73 1004705      7 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf247:        76      83      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:        77       2      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:        90 1004139     12 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf247:        98      88      2 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       100       2      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       110 1004943      9 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf247:       113      58      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       114       2      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       124 1003992      8 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf247:       128      68      0 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       136      67      2 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       152 1004386     10 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf247:       165     200      8 __pthread_canceled(0x1, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       166       4      0 __pthread_canceled(0x2, 0x100605E20, 0x0)        = 0 0
  643/0xaf247:       177 1003822     10 select(0x400, 0x100605E20, 0x0, 0x0, 0x100605E10)        = 0 0
  643/0xaf247:       182      54      1 shutdown(0xF, 0x2, 0x0)      = -1 Err#57
  643/0xaf247:       188       7      4 close(0xF)       = 0 0
  643/0xaf25a:        22      56      0 thread_selfid(0x0, 0x0, 0x0)         = 717402 0
  643/0xaf25a:        28       3      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf25a:        32       6      3 psynch_cvsignal(0x600000160748, 0x100, 0x0)      = 257 0
  643/0xaf25a:        35       2      0 __pthread_canceled(0x1, 0x100, 0x0)      = 0 0
  643/0xaf25a:        36       2      0 __pthread_canceled(0x2, 0x100, 0x0)      = 0 0
  643/0xaf25a:        41       7      4 socket(0x2, 0x2, 0x0)        = 14 0
  643/0xaf25a:        44       4      1 fcntl(0xE, 0x4, 0x4)         = 0 0
  643/0xaf25a:        47       6      2 setsockopt(0xE, 0xFFFF, 0x20)        = 0 0
  643/0xaf25a:        88      43     39 sendto(0xE, 0x10000AD00, 0x10)       = 16 0
  643/0xaf247:       196 1003587      6 __semwait_signal(0xD07, 0x0, 0x1)        = -1 Err#60
  643/0xaf247:       206      56      2 __disable_threadsignal(0x1, 0x0, 0x1)        = 0 0
  643/0xaf25a:       100     110      0 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf25a:       101       2      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
  643/0xaf25a:       109 1003598      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf25a:       113      57      1 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       114       3      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       122 1000135      7 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf25a:       127      73      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       128       3      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       136 1004577      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf25a:       140      91      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       142       4      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       149 1000961      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf25a:       151      57      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       153       4      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       159 1002299      6 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf25a:       163      93      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       165       5      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf25a:       174 1003983      7 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf25a:       177      60      1 shutdown(0xE, 0x2, 0x0)      = -1 Err#57
  643/0xaf25a:       180       5      2 close(0xE)       = 0 0
  643/0xaf25a:       185 1004727      3 __semwait_signal(0xD07, 0x0, 0x1)        = -1 Err#60
  643/0xaf25a:       191      75      2 __disable_threadsignal(0x1, 0x0, 0x1)        = 0 0
  643/0xaf287:         8     103      0 thread_selfid(0x0, 0x0, 0x0)         = 717447 0
  643/0xaf287:        17       4      0 __pthread_canceled(0x2, 0x0, 0x0)        = 0 0
  643/0xaf287:        23       9      4 psynch_cvsignal(0x600000161948, 0x100, 0x0)      = 257 0
  643/0xaf287:        28       8      3 psynch_mutexdrop(0x600000161908, 0x303, 0x200)       = 0 0
  643/0xaf287:        34       5      1 __pthread_canceled(0x1, 0x303, 0x200)        = 0 0
  643/0xaf287:        35       3      0 __pthread_canceled(0x2, 0x303, 0x200)        = 0 0
  643/0xaf287:        44      12      8 socket(0x2, 0x2, 0x0)        = 14 0
  643/0xaf287:        47       5      1 fcntl(0xE, 0x4, 0x4)         = 0 0
  643/0xaf287:        50       6      2 setsockopt(0xE, 0xFFFF, 0x20)        = 0 0
  643/0xaf287:        94      46     42 sendto(0xE, 0x10000AD00, 0x10)       = 16 0
  643/0xaf287:        96       3      0 __pthread_canceled(0x1, 0x10000AD00, 0x10)       = 0 0
  643/0xaf287:        97       3      0 __pthread_canceled(0x2, 0x10000AD00, 0x10)       = 0 0
  643/0xaf287:       114 1004632     16 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf287:       118     100      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf287:       119       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf287:       136      65      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf287:       138       2      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf287:       131 1005010     11 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0
  643/0xaf287:       156     101      0 __pthread_canceled(0x1, 0x100582E20, 0x0)        = 0 0
  643/0xaf287:       157       3      0 __pthread_canceled(0x2, 0x100582E20, 0x0)        = 0 0
  643/0xaf287:       148 1000190      9 select(0x400, 0x100582E20, 0x0, 0x0, 0x100582E10)        = 0 0

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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-03 11:25 Deadlock when receiving kill-signal from child process Mathias Fredriksson
@ 2015-08-03 15:52 ` Bart Schaefer
  2015-08-03 20:36   ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-03 15:52 UTC (permalink / raw)
  To: zsh-workers

On Aug 3,  2:25pm, Mathias Fredriksson wrote:
} 
} On OSX 10.10 using ZSH 5.0.5 (OSX), 5.0.7 and 5.0.8 (Homebrew) I am
} able to trigger a deadlock of zsh when sending a kill-signal from a
} child process to a parent process.

Is that 5.0.8 or 5.0.8-dev-1 from SourceForge git?

I *think* this problem should have been fixed by workers/35642 (git
811027a22a806f753537abee1575da8714d3fa0a) and I cannot reproduce with
ZSH_PATCHLEVEL = zsh-5.0.8-154-gd90f921.

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-03 15:52 ` Bart Schaefer
@ 2015-08-03 20:36   ` Mathias Fredriksson
  2015-08-03 20:58     ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-03 20:36 UTC (permalink / raw)
  To: zsh-workers

On Mon, Aug 3, 2015 at 6:52 PM, Bart Schaefer wrote:
}
} Is that 5.0.8 or 5.0.8-dev-1 from SourceForge git?

It is 5.0.8

}
} I *think* this problem should have been fixed by workers/35642 (git
} 811027a22a806f753537abee1575da8714d3fa0a) and I cannot reproduce with
} ZSH_PATCHLEVEL = zsh-5.0.8-154-gd90f921.

I just tried applying this patch to 5.0.8 and I am still able to
reproduce, occasionally zsh even exits with the following (maybe
related):

zsh: illegal hardware instruction  ./zsh_deadlock.zsh

If workers/35642 alone was supposed to fix this I think it remains unfixed.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-03 20:36   ` Mathias Fredriksson
@ 2015-08-03 20:58     ` Bart Schaefer
  2015-08-04 21:52       ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-03 20:58 UTC (permalink / raw)
  To: zsh-workers

On Aug 3, 11:36pm, Mathias Fredriksson wrote:
}
} I just tried applying this patch to 5.0.8 and I am still able to
} reproduce, occasionally zsh even exits with the following (maybe
} related):
} 
} zsh: illegal hardware instruction  ./zsh_deadlock.zsh

If you can get a stack trace from the deadlocked zsh, that would be
helpful.

A stack trace from the SIGILL's zsh might also be helpful, but that is
less likely.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-03 20:58     ` Bart Schaefer
@ 2015-08-04 21:52       ` Mathias Fredriksson
  2015-08-05  0:05         ` Mathias Fredriksson
  2015-08-05  6:53         ` Bart Schaefer
  0 siblings, 2 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-04 21:52 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

On Mon, Aug 3, 2015 at 11:58 PM, Bart Schaefer wrote:
}
} If you can get a stack trace from the deadlocked zsh, that would be
} helpful.

I've tried to produce a stack trace on OS X with dtruss, but it slows
down zsh too much and I am never able to reproduce the deadlock
scenario. I have however managed to get a dump with strace on Gentoo
(also here, I've applied the patch discussed earlier), see attachment.

}
} A stack trace from the SIGILL's zsh might also be helpful, but that is
} less likely.

I will see if I manage to do it, but even without a debugger, I have
rarely seen this error.

[-- Attachment #2: deadlock.trace --]
[-- Type: application/octet-stream, Size: 52272 bytes --]

execve("./deadlock.zsh", ["./deadlock.zsh"], [/* 16 vars */]) = 0
brk(0)                                  = 0xdbc000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fed2e89b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=28002, ...}) = 0
mmap(NULL, 28002, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fed2e894000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\33\2\0\0\0\0\0@\0\0\0\0\0\0\0\210\364\31\0\0\0\0\0\0\0\0\0@\0008\0\v\0@\0A\0@\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0h\2\0\0\0\0\0\0h\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\360\330\26\0\0\0\0\0\360\330\26\0\0\0\0\0\360\330\26\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\322\220\31\0\0\0\0\0\322\220\31\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0`\227\31\0\0\0\0\0`\2279\0\0\0\0\0`\2279\0\0\0\0\0\370O\0\0\0\0\0\0\370\224\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\240\313\31\0\0\0\0\0\240\3139\0\0\0\0\0\240\3139\0\0\0\0\0\340\1\0\0\0\0\0\0\340\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\250\2\0\0\0\0\0\0\250\2\0\0\0\0\0\0\250\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0\7\0\0\0\4\0\0\0`\227\31\0\0\0\0\0`\2279\0\0\0\0\0`\2279\0\0\0\0\0\20\0\0\0\0\0\0\0\200\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0P\345td\4\0\0\0\f\331\26\0\0\0\0\0\f\331\26\0\0\0\0\0\f\331\26\0\0\0\0\0li\0\0\0\0\0\0li\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0`\227\31\0\0\0\0\0`\2279\0\0\0\0\0`\2279\0\0\0\0\0\2408\0\0\0\0\0\0\2408\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0\363\3\0\0\n\0\0\0\0\1\0\0\16\0\0\0\0000\20D\240 \2\1\210\3\346\220\305E\214\0\300\0\10\0\5\200\0`\300\200\0\r\212\f\0\4\20\0\210D2\10.@\210P4, \16\"H&\204\300\214\4\10\0\2\2\16\241\254\32\4f\300\0\3002\0\300\0P\1"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1705160, ...}) = 0
mmap(NULL, 3812440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fed2e2d9000
mprotect(0x7fed2e473000, 2093056, PROT_NONE) = 0
mmap(0x7fed2e672000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x199000) = 0x7fed2e672000
mmap(0x7fed2e678000, 15448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fed2e678000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fed2e893000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fed2e892000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fed2e891000
arch_prctl(ARCH_SET_FS, 0x7fed2e892700) = 0
mprotect(0x7fed2e672000, 16384, PROT_READ) = 0
mprotect(0x605000, 4096, PROT_READ)     = 0
mprotect(0x7fed2e89c000, 4096, PROT_READ) = 0
munmap(0x7fed2e894000, 28002)           = 0
brk(0)                                  = 0xdbc000
brk(0xddd000)                           = 0xddd000
open("/usr/lib64/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1607712, ...}) = 0
mmap(NULL, 1607712, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fed2e708000
close(3)                                = 0
execve("/bin/zsh", ["zsh", "./deadlock.zsh"], [/* 16 vars */]) = 0
brk(0)                                  = 0x1b1b000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c877d000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=28002, ...}) = 0
mmap(NULL, 28002, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff1c8776000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\16\0\0\0\0\0\0@\0\0\0\0\0\0\0\2201\0\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0\33\0\32\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0P\32\0\0\0\0\0\0P\32\0\0\0\0\0\0P\32\0\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0T\36\0\0\0\0\0\0T\36\0\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0p-\0\0\0\0\0\0p- \0\0\0\0\0p- \0\0\0\0\0000\3\0\0\0\0\0\0\250\3\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\230-\0\0\0\0\0\0\230- \0\0\0\0\0\230- \0\0\0\0\0\0\2\0\0\0\0\0\0\0\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0P\345td\4\0\0\0l\32\0\0\0\0\0\0l\32\0\0\0\0\0\0l\32\0\0\0\0\0\0\274\0\0\0\0\0\0\0\274\0\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0p-\0\0\0\0\0\0p- \0\0\0\0\0p- \0\0\0\0\0\220\2\0\0\0\0\0\0\220\2\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0\33\0\0\0\33\0\0\0\2\0\0\0\7\0\0\0\230\2\21\0\200H\0\4\22\0\0@\203(\10\236\33\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\0\0\0\0\35\0\0\0\0\0\0\0\36\0\0\0\0\0\0\0\37\0\0\0\0\0\0\0 \0\0\0\0\0\0\0!\0\0\0#\0\0\0$\0\0\0&\0\0\0'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0(\0\0\0\0\0\0\0\0\0\0\0\353\26\251\30"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=14416, ...}) = 0
mmap(NULL, 2109720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff1c835a000
mprotect(0x7ff1c835c000, 2097152, PROT_NONE) = 0
mmap(0x7ff1c855c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7ff1c855c000
close(3)                                = 0
open("/lib64/libncursesw.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0pS\1\0\0\0\0\0@\0\0\0\0\0\0\0X\1\6\0\0\0\0\0\0\0\0\0@\0008\0\7\0@\0\31\0\30\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\214\257\5\0\0\0\0\0\214\257\5\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0\220\273\5\0\0\0\0\0\220\273%\0\0\0\0\0\220\273%\0\0\0\0\0\360D\0\0\0\0\0\0\270N\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\200\354\5\0\0\0\0\0\200\354%\0\0\0\0\0\200\354%\0\0\0\0\0\320\1\0\0\0\0\0\0\320\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0P\345td\4\0\0\0\264,\5\0\0\0\0\0\264,\5\0\0\0\0\0\264,\5\0\0\0\0\0\304\25\0\0\0\0\0\0\304\25\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0\220\273\5\0\0\0\0\0\220\273%\0\0\0\0\0\220\273%\0\0\0\0\0p4\0\0\0\0\0\0p4\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\305\3\0\0g\0\0\0@\0\0\0\f\0\0\0J \306\10\0\204&\210\2611\f!\3160\t\32h\240\1\1\300P0\21\27&\356B\1B\206A\34\202@\5\2\t(!\0\204\4 \0\1\0020\2\20\0\240\0%\21A\312\35\311a\1\242\247\20m\1\241\4\1\20 H|\20\300\0\240A\0\6PD\4\221\n\0\\F\0\0 \22\30\220\0034H\7\214 \1\204s%P\206 *\210\0012\1\30\0\205\0\0@\20\10\2\200B4\6\f#`\4\304\0@\2\22\3\6\1c\f&\300B\0001@\320\20\f\30D\202\220\20\205\264Q4M\0\212\10Ps\5\nf\260\4\210Q\320\302V\261\34\v\20\4\240,\200\250\t\f\2068R\0B\0\2$\302\202\20\1 \0\332\204-\302\2619\260\0$\21\1\0\24\0\1\31Vd.\214\220$\2\0\f\242\202\fX@\10\4\f!\233!;0C\"\7!\370\372\200\210\5\200\363\21\2\31\7\0\222\303\223V@P1(\1\0\2\2D\1(=\211\t4\t$\0\20\4\0\22\24\214*\202\224\230\322\2\5j\214\320\nB\223\254\0247\226\0\1\3\20 \10 R8`\7\4A\0\200A\0\22\0\240\305\302\20(\4,\320\210\3408\20"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=395160, ...}) = 0
mmap(NULL, 2493000, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff1c80f9000
mprotect(0x7ff1c8154000, 2097152, PROT_NONE) = 0
mmap(0x7ff1c8354000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5b000) = 0x7ff1c8354000
close(3)                                = 0
open("/lib64/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360T\0\0\0\0\0\0@\0\0\0\0\0\0\0\330\341\17\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0\33\0\32\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\340p\17\0\0\0\0\0\340p\17\0\0\0\0\0\340p\17\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\274\332\17\0\0\0\0\0\274\332\17\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0\240\335\17\0\0\0\0\0\240\335/\0\0\0\0\0\240\335/\0\0\0\0\0L\3\0\0\0\0\0\0\230\3\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\270\335\17\0\0\0\0\0\270\335/\0\0\0\0\0\270\335/\0\0\0\0\0\0\2\0\0\0\0\0\0\0\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0P\345td\4\0\0\0\374p\17\0\0\0\0\0\374p\17\0\0\0\0\0\374p\17\0\0\0\0\0\374\22\0\0\0\0\0\0\374\22\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0\240\335\17\0\0\0\0\0\240\335/\0\0\0\0\0\240\335/\0\0\0\0\0`\2\0\0\0\0\0\0`\2\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0\35\3\0\0\24\0\0\0@\0\0\0\f\0\0\0%\0`\0\0\240.\"\200\0\26\211\0 E\"\2\0\300``i\10\212\0\t\0\0\0\0\0\0\0\0\0\0\0\0\212P\20\1\10\0\0\4\1\302\24\1 \210\"\0\304\243X\240\n\6\216\0\212\0\0\4\0@\0\0 \20\0\5\0\5\r\7\7\22A\0\1\0\10\0\0@\0\t\0\20\4D\30\4\200a(\22@\4\1\nE\221 @\200\f\22\1\0\0\0\0\0\0\0\0\4\2\0\0\0@\0\200"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1042584, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c8775000
mmap(NULL, 3137848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff1c7dfa000
mprotect(0x7ff1c7ef8000, 2093056, PROT_NONE) = 0
mmap(0x7ff1c80f7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xfd000) = 0x7ff1c80f7000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\33\2\0\0\0\0\0@\0\0\0\0\0\0\0\210\364\31\0\0\0\0\0\0\0\0\0@\0008\0\v\0@\0A\0@\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0h\2\0\0\0\0\0\0h\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\360\330\26\0\0\0\0\0\360\330\26\0\0\0\0\0\360\330\26\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\322\220\31\0\0\0\0\0\322\220\31\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0`\227\31\0\0\0\0\0`\2279\0\0\0\0\0`\2279\0\0\0\0\0\370O\0\0\0\0\0\0\370\224\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\240\313\31\0\0\0\0\0\240\3139\0\0\0\0\0\240\3139\0\0\0\0\0\340\1\0\0\0\0\0\0\340\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\250\2\0\0\0\0\0\0\250\2\0\0\0\0\0\0\250\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0\7\0\0\0\4\0\0\0`\227\31\0\0\0\0\0`\2279\0\0\0\0\0`\2279\0\0\0\0\0\20\0\0\0\0\0\0\0\200\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0P\345td\4\0\0\0\f\331\26\0\0\0\0\0\f\331\26\0\0\0\0\0\f\331\26\0\0\0\0\0li\0\0\0\0\0\0li\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0`\227\31\0\0\0\0\0`\2279\0\0\0\0\0`\2279\0\0\0\0\0\2408\0\0\0\0\0\0\2408\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0\363\3\0\0\n\0\0\0\0\1\0\0\16\0\0\0\0000\20D\240 \2\1\210\3\346\220\305E\214\0\300\0\10\0\5\200\0`\300\200\0\r\212\f\0\4\20\0\210D2\10.@\210P4, \16\"H&\204\300\214\4\10\0\2\2\16\241\254\32\4f\300\0\3002\0\300\0P\1"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1705160, ...}) = 0
mmap(NULL, 3812440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7ff1c7a57000
mprotect(0x7ff1c7bf1000, 2093056, PROT_NONE) = 0
mmap(0x7ff1c7df0000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x199000) = 0x7ff1c7df0000
mmap(0x7ff1c7df6000, 15448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff1c7df6000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c8774000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c8773000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c8772000
arch_prctl(ARCH_SET_FS, 0x7ff1c8773700) = 0
mprotect(0x7ff1c7df0000, 16384, PROT_READ) = 0
mprotect(0x7ff1c80f7000, 4096, PROT_READ) = 0
mprotect(0x7ff1c8354000, 16384, PROT_READ) = 0
mprotect(0x7ff1c855c000, 4096, PROT_READ) = 0
mprotect(0x6aa000, 4096, PROT_READ)     = 0
mprotect(0x7ff1c877e000, 4096, PROT_READ) = 0
munmap(0x7ff1c8776000, 28002)           = 0
brk(0)                                  = 0x1b1b000
brk(0x1b3c000)                          = 0x1b3c000
open("/usr/lib64/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1607712, ...}) = 0
mmap(NULL, 1607712, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7ff1c85e9000
close(3)                                = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
getuid()                                = 0
geteuid()                               = 0
getgid()                                = 0
getegid()                               = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0
readlink("/proc/self/fd/0", "/dev/pts/5", 4095) = 10
stat("/dev/pts/5", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0
open("/dev/pts/5", O_RDWR|O_NOCTTY)     = 3
fcntl(3, F_DUPFD, 10)                   = 10
close(3)                                = 0
fcntl(10, F_GETFD)                      = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
getpid()                                = 49318
pipe([3, 4])                            = 0
dup(0)                                  = 5
dup(0)                                  = 6
dup(0)                                  = 7
dup(0)                                  = 8
dup(0)                                  = 9
getppid()                               = 49316
getuid()                                = 0
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 11
fcntl(11, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
fstat(11, {st_mode=S_IFREG|0644, st_size=508, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c877c000
read(11, "# /etc/nsswitch.conf:\n# $Header: /var/cvsroot/gentoo/src/patchsets/glibc/extra/etc/nsswitch.conf,v 1.1 2006/09/29 23:52:23 vapier Exp $\n\npasswd:      compat\nshadow:      compat\ngroup:       compat\n\n# passwd:    db files nis\n# shadow:    db files nis\n# group:     db files nis\n\nhosts:       files dns\nnetworks:    files dns\n\nservices:    db files\nprotocols:   db files\nrpc:         db files\nethers:      db files\nnetmasks:    files\nnetgroup:    files\nbootparams:  files\n\nautomount:   files\naliases:     files\n", 4096) = 508
read(11, "", 4096)                      = 0
close(11)                               = 0
munmap(0x7ff1c877c000, 4096)            = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=28002, ...}) = 0
mmap(NULL, 28002, PROT_READ, MAP_PRIVATE, 11, 0) = 0x7ff1c8776000
close(11)                               = 0
open("/lib64/libnss_compat.so.2", O_RDONLY|O_CLOEXEC) = 11
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\24\0\0\0\0\0\0@\0\0\0\0\0\0\0\360\203\0\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0\33\0\32\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0Pb\0\0\0\0\0\0Pb\0\0\0\0\0\0Pb\0\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\364m\0\0\0\0\0\0\364m\0\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0\230}\0\0\0\0\0\0\230} \0\0\0\0\0\230} \0\0\0\0\0h\5\0\0\0\0\0\0(\7\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\260}\0\0\0\0\0\0\260} \0\0\0\0\0\260} \0\0\0\0\0\20\2\0\0\0\0\0\0\20\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0P\345td\4\0\0\0lb\0\0\0\0\0\0lb\0\0\0\0\0\0lb\0\0\0\0\0\0\254\1\0\0\0\0\0\0\254\1\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0\230}\0\0\0\0\0\0\230} \0\0\0\0\0\230} \0\0\0\0\0h\2\0\0\0\0\0\0h\2\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0\32\0\0\0)\0\0\0\2\0\0\0\7\0\0\0Q\0\1\2\20\t\220\r\20\4\23\200\1H\272\201)\0\0\0*\0\0\0+\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0,\0\0\0-\0\0\0.\0\0\0\0\0\0\0000\0\0\0\0\0\0\0\0\0\0\0002\0\0\0003\0\0\0004\0\0\0\0\0\0\0\0\0\0\0005\0\0\0\0\0\0\0006\0\0\0007\0\0\0\0\0\0\0008\0\0\0\207[\246\22\365\33=\274"..., 832) = 832
fstat(11, {st_mode=S_IFREG|0755, st_size=35504, ...}) = 0
mmap(NULL, 2131136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 11, 0) = 0x7ff1c784e000
mprotect(0x7ff1c7855000, 2097152, PROT_NONE) = 0
mmap(0x7ff1c7a55000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 11, 0x7000) = 0x7ff1c7a55000
close(11)                               = 0
open("/lib64/libnsl.so.1", O_RDONLY|O_CLOEXEC) = 11
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0pA\0\0\0\0\0\0@\0\0\0\0\0\0\0XD\1\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0\33\0\32\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\200\26\1\0\0\0\0\0\200\26\1\0\0\0\0\0\200\26\1\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\224:\1\0\0\0\0\0\224:\1\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0h=\1\0\0\0\0\0h=!\0\0\0\0\0h=!\0\0\0\0\0\0\6\0\0\0\0\0\0000-\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\200=\1\0\0\0\0\0\200=!\0\0\0\0\0\200=!\0\0\0\0\0\0\2\0\0\0\0\0\0\0\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0P\345td\4\0\0\0\234\26\1\0\0\0\0\0\234\26\1\0\0\0\0\0\234\26\1\0\0\0\0\0\234\5\0\0\0\0\0\0\234\5\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0h=\1\0\0\0\0\0h=!\0\0\0\0\0h=!\0\0\0\0\0\230\2\0\0\0\0\0\0\230\2\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0\370\0\0\0s\0\0\0\20\0\0\0\n\0\0\0\1\0015\232 '@\0@\0\0\2\f!\1\10\0:\0\0\241\nX\0H\0\16,\0\5\200\6`\260\23 @\224\21\20@\344r\224D\350\206@1\250\202@\260z\1=\10\331\0\0\20\26\200\0044B\201*\0209\203K\200\20 \"\221\3\0D\200\302*d`E\10\0\4\4\t\4PDB\200\20\300\22!\4`@\0\32 \0\0\0\10\4\2\200\220\200\0\344#\0\212$\2\206\210\0\0`\300"..., 832) = 832
fstat(11, {st_mode=S_IFREG|0755, st_size=84760, ...}) = 0
mmap(NULL, 2189976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 11, 0) = 0x7ff1c7637000
mprotect(0x7ff1c764b000, 2093056, PROT_NONE) = 0
mmap(0x7ff1c784a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 11, 0x13000) = 0x7ff1c784a000
mmap(0x7ff1c784c000, 6808, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7ff1c784c000
close(11)                               = 0
mprotect(0x7ff1c784a000, 4096, PROT_READ) = 0
mprotect(0x7ff1c7a55000, 4096, PROT_READ) = 0
munmap(0x7ff1c8776000, 28002)           = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=28002, ...}) = 0
mmap(NULL, 28002, PROT_READ, MAP_PRIVATE, 11, 0) = 0x7ff1c8776000
close(11)                               = 0
open("/lib64/libnss_nis.so.2", O_RDONLY|O_CLOEXEC) = 11
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\"\0\0\0\0\0\0@\0\0\0\0\0\0\0\220\242\0\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0\33\0\32\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\20\207\0\0\0\0\0\0\20\207\0\0\0\0\0\0\20\207\0\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\214\230\0\0\0\0\0\0\214\230\0\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0\200\235\0\0\0\0\0\0\200\235 \0\0\0\0\0\200\235 \0\0\0\0\0$\4\0\0\0\0\0\0X\7\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\230\235\0\0\0\0\0\0\230\235 \0\0\0\0\0\230\235 \0\0\0\0\0 \2\0\0\0\0\0\0 \2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0P\345td\4\0\0\0,\207\0\0\0\0\0\0,\207\0\0\0\0\0\0,\207\0\0\0\0\0\0d\2\0\0\0\0\0\0d\2\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0\200\235\0\0\0\0\0\0\200\235 \0\0\0\0\0\200\235 \0\0\0\0\0\200\2\0\0\0\0\0\0\200\2\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0g\0\0\0005\0\0\0\10\0\0\0\t\0\0\0\0\0\4X\" \22\0\0\0Bg\3\0\1\4\t\03448P\30\6\243\331\220\212$ \1\10\0\342@\310\224E\20\211\244\0\0\4\20\10@\0@!\0\0\4\0\0\0\200\0\v\0y\343\0D\202\0\0\0\0005\0\0\0006\0\0\0\0\0\0\0007\0\0\0008\0\0\0009\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0:\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0;\0\0\0\0\0\0\0"..., 832) = 832
fstat(11, {st_mode=S_IFREG|0755, st_size=43344, ...}) = 0
mmap(NULL, 2139352, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 11, 0) = 0x7ff1c742c000
mprotect(0x7ff1c7436000, 2093056, PROT_NONE) = 0
mmap(0x7ff1c7635000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 11, 0x9000) = 0x7ff1c7635000
close(11)                               = 0
open("/lib64/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 11
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0#\0\0\0\0\0\0@\0\0\0\0\0\0\0h\262\0\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0\33\0\32\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\260\225\0\0\0\0\0\0\260\225\0\0\0\0\0\0\260\225\0\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0d\255\0\0\0\0\0\0d\255\0\0\0\0\0\0\0\0 \0\0\0\0\0\1\0\0\0\6\0\0\0\230\255\0\0\0\0\0\0\230\255 \0\0\0\0\0\230\255 \0\0\0\0\0\340\3\0\0\0\0\0\0\30\10\0\0\0\0\0\0\0\0 \0\0\0\0\0\2\0\0\0\6\0\0\0\260\255\0\0\0\0\0\0\260\255 \0\0\0\0\0\260\255 \0\0\0\0\0\0\2\0\0\0\0\0\0\0\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0\4\0\0\0\0\0\0\0P\345td\4\0\0\0\314\225\0\0\0\0\0\0\314\225\0\0\0\0\0\0\314\225\0\0\0\0\0\0D\3\0\0\0\0\0\0D\3\0\0\0\0\0\0\4\0\0\0\0\0\0\0Q\345td\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0R\345td\4\0\0\0\230\255\0\0\0\0\0\0\230\255 \0\0\0\0\0\230\255 \0\0\0\0\0h\2\0\0\0\0\0\0h\2\0\0\0\0\0\0\1\0\0\0\0\0\0\0\200\25\4e\0(\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0k\0\0\0002\0\0\0\10\0\0\0\t\0\0\0\22F\344\25\240\245\201\0\t\10\2\30\223\6\210\0\0\0z\0]\201\240Jx\2108*\220\200\0$\7!\5\24)\"\226<\0\4\0\33\0\20\2\0\0@\10\201\3100\200\200B@\206\0\302\0\200\3002\0\0\0003\0\0\0\0\0\0\0004\0\0\0005\0\0\0006\0\0\0007\0\0\0008\0\0\0\0\0\0\0009\0\0\0\0\0\0\0:\0\0\0<\0\0\0=\0\0\0\0\0\0\0?\0\0\0"..., 832) = 832
fstat(11, {st_mode=S_IFREG|0755, st_size=47400, ...}) = 0
mmap(NULL, 2143664, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 11, 0) = 0x7ff1c7220000
mprotect(0x7ff1c722b000, 2093056, PROT_NONE) = 0
mmap(0x7ff1c742a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 11, 0xa000) = 0x7ff1c742a000
close(11)                               = 0
mprotect(0x7ff1c742a000, 4096, PROT_READ) = 0
mprotect(0x7ff1c7635000, 4096, PROT_READ) = 0
munmap(0x7ff1c8776000, 28002)           = 0
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 11
fcntl(11, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
lseek(11, 0, SEEK_CUR)                  = 0
fstat(11, {st_mode=S_IFREG|0644, st_size=1057, ...}) = 0
mmap(NULL, 1057, PROT_READ, MAP_SHARED, 11, 0) = 0x7ff1c877c000
lseek(11, 1057, SEEK_SET)               = 1057
munmap(0x7ff1c877c000, 1057)            = 0
close(11)                               = 0
stat("/root", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c8779000
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("..", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "..", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 11
getdents(11, /* 4 entries */, 32768)    = 112
lstat("../mathias", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
close(11)                               = 0
chdir("..")                             = 0
stat("..", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
openat(AT_FDCWD, "..", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 11
getdents(11, /* 23 entries */, 32768)   = 592
lstat("../home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
close(11)                               = 0
chdir("..")                             = 0
stat("..", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chdir("/home/mathias")                  = 0
open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 11
fstat(11, {st_mode=S_IFREG|0644, st_size=26244, ...}) = 0
mmap(NULL, 26244, PROT_READ, MAP_SHARED, 11, 0) = 0x7ff1c85e2000
close(11)                               = 0
uname({sysname="Linux", nodename="asustorx", ...}) = 0
open("/proc/self/loginuid", O_RDONLY)   = 11
read(11, "1000", 12)                    = 4
close(11)                               = 0
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 11
lseek(11, 0, SEEK_CUR)                  = 0
fstat(11, {st_mode=S_IFREG|0644, st_size=1057, ...}) = 0
mmap(NULL, 1057, PROT_READ, MAP_SHARED, 11, 0) = 0x7ff1c8778000
lseek(11, 1057, SEEK_SET)               = 1057
munmap(0x7ff1c8778000, 1057)            = 0
close(11)                               = 0
uname({sysname="Linux", nodename="asustorx", ...}) = 0
ioctl(10, TIOCGWINSZ, {ws_row=29, ws_col=125, ws_xpixel=0, ws_ypixel=0}) = 0
getrlimit(RLIMIT_CPU, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_FSIZE, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_DATA, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_CORE, {rlim_cur=0, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_RSS, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_NPROC, {rlim_cur=31595, rlim_max=31595}) = 0
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
getrlimit(RLIMIT_MEMLOCK, {rlim_cur=64*1024, rlim_max=64*1024}) = 0
getrlimit(RLIMIT_AS, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_LOCKS, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrlimit(RLIMIT_SIGPENDING, {rlim_cur=31595, rlim_max=31595}) = 0
getrlimit(RLIMIT_MSGQUEUE, {rlim_cur=800*1024, rlim_max=800*1024}) = 0
getrlimit(RLIMIT_NICE, {rlim_cur=0, rlim_max=0}) = 0
getrlimit(RLIMIT_RTPRIO, {rlim_cur=0, rlim_max=0}) = 0
getrlimit(RLIMIT_RTTIME, {rlim_cur=RLIM64_INFINITY, rlim_max=RLIM64_INFINITY}) = 0
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 0
close(3)                                = 0
close(4)                                = 0
close(5)                                = 0
close(6)                                = 0
close(7)                                = 0
close(8)                                = 0
close(9)                                = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [QUIT], SA_RESTORER|SA_RESTART, 0x7ff1c7a8c480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGHUP, {SIG_IGN, [HUP], SA_RESTORER|SA_RESTART, 0x7ff1c7a8c480}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGHUP, {0x478810, [], SA_RESTORER, 0x7ff1c7a8c480}, NULL, 8) = 0
rt_sigaction(SIGCHLD, {0x478810, [], SA_RESTORER, 0x7ff1c7a8c480}, NULL, 8) = 0
rt_sigaction(SIGWINCH, {0x478810, [], SA_RESTORER, 0x7ff1c7a8c480}, NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
stat("/etc/zsh/zshenv.zwc", 0x7fff0bbc5280) = -1 ENOENT (No such file or directory)
stat("/etc/zsh/zshenv", 0x7fff0bbc5310) = -1 ENOENT (No such file or directory)
open("/etc/zsh/zshenv", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
stat("/root/.zshenv.zwc", 0x7fff0bbc5280) = -1 ENOENT (No such file or directory)
stat("/root/.zshenv", 0x7fff0bbc5310)   = -1 ENOENT (No such file or directory)
open("/root/.zshenv", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
access("./deadlock.zsh", F_OK)          = 0
stat("./deadlock.zsh", {st_mode=S_IFREG|0755, st_size=232, ...}) = 0
open("./deadlock.zsh", O_RDONLY|O_NOCTTY) = 3
fcntl(3, F_DUPFD, 10)                   = 11
close(3)                                = 0
fcntl(11, F_GETFL)                      = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(11, {st_mode=S_IFREG|0755, st_size=232, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1c8778000
lseek(11, 0, SEEK_CUR)                  = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
read(11, "#!/usr/bin/env zsh\n\nchild() {\n    sleep 0.001\n    kill -USR1 $$\n    sleep 0.000001\n    kill -USR1 $$\n}\n\nTRAPUSR1() {\n    print -n \".\"\n}\n\nfor i in {1..10}; do\n    child &!\ndone\n\nfor i in {1..99}; do\n    sleep 0.000001\ndone\n\nsleep 1\n\n", 4096) = 232
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigaction(SIGUSR1, {0x478810, [], SA_RESTORER, 0x7ff1c7a8c480}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49319
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49321
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49323
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49325
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49319, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49321, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49329
close(4)                                = 0
read(3, 0x7fff0bbc4940, 1)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49323, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49319, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49319
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 0
wait4(-1, 0x7fff0bbc2efc, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc2f20) = 0
rt_sigreturn({mask=[USR1 WINCH]})       = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49331
close(4)                                = 0
read(3, "", 1)                          = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49321, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49321, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49321
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 0
wait4(-1, 0x7fff0bbc2efc, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc2f20) = 0
rt_sigreturn({mask=[USR1 WINCH]})       = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49334
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49336
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49338
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49340
close(4)                                = 0
read(3, "", 1)                          = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49325, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
close(3)                                = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [WINCH], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
access("/bin/sleep", X_OK)              = 0
stat("/bin/sleep", {st_mode=S_IFREG|0755, st_size=27008, ...}) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49343
close(4)                                = 0
read(3, "", 1)                          = 0
close(3)                                = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigsuspend([INT], 8)                 = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49329, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [INT USR1], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT USR1], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigsuspend([INT], 8)                 = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49325, si_uid=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49325, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [INT USR1 CHLD], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT USR1 CHLD], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 1000}, ...}) = 49325
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 1000}, ...}) = 0
wait4(-1, 0x7fff0bbc397c, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc39a0) = 0
rt_sigreturn({mask=[INT USR1]})         = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [INT USR1], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT USR1], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigsuspend([INT], 8)                 = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49323, si_uid=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49323, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [INT USR1 CHLD], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT USR1 CHLD], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49323
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 1000}, ...}) = 0
wait4(-1, 0x7fff0bbc397c, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc39a0) = 0
rt_sigreturn({mask=[INT USR1]})         = 0
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [INT USR1], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT USR1], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigsuspend([INT], 8)                 = ? ERESTARTNOHAND (To be restarted if no handler)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49343, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [INT CHLD], 8) = 0
rt_sigprocmask(SIG_SETMASK, [INT CHLD], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49343
wait4(-1, 0x7fff0bbc3f3c, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc3f60) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49340, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [WINCH], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7ff1c87739d0) = 49347
close(4)                                = 0
read(3, 0x7fff0bbc4940, 1)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49334, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49336, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
read(3, 0x7fff0bbc4940, 1)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49329, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49329, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49329
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 1000}, ...}) = 0
wait4(-1, 0x7fff0bbc2efc, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc2f20) = 0
rt_sigreturn({mask=[USR1 WINCH]})       = 0
rt_sigreturn({mask=[CHLD WINCH]})       = -1 EINTR (Interrupted system call)
read(3, "", 1)                          = 0
close(3)                                = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49338, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49338, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 1000}, ...}) = 49338
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 2000}, ...}) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49340
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 2000}, ...}) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49347
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 2000}, ...}) = 0
wait4(-1, 0x7fff0bbc2f3c, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc2f60) = 0
rt_sigreturn({mask=[USR1 WINCH]})       = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49347, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49336
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 2000}, ...}) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49334
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 2000}, ...}) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED|WCONTINUED, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 49331
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 2000}, ...}) = 0
wait4(-1, 0x7fff0bbc2f3c, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc2f60) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[USR1 WINCH]})       = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=49334, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
wait4(-1, 0x7fff0bbc2f3c, WNOHANG|WSTOPPED|WCONTINUED, 0x7fff0bbc2f60) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[USR1 WINCH]})       = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
--- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=49340, si_uid=0} ---
rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_SETMASK, [USR1 CHLD WINCH], ~[KILL STOP RTMIN RT_1], 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
write(1, ".", 1)                        = 1
rt_sigprocmask(SIG_BLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [CHLD], [USR1 CHLD WINCH], 8) = 0
rt_sigreturn({mask=[CHLD WINCH]})       = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [CHLD WINCH], 8) = 0
rt_sigsuspend([INT], 8

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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-04 21:52       ` Mathias Fredriksson
@ 2015-08-05  0:05         ` Mathias Fredriksson
  2015-08-05  6:53         ` Bart Schaefer
  1 sibling, 0 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-05  0:05 UTC (permalink / raw)
  To: zsh-workers

I can't seem to produce wanted gdb output of the frozen state. If i
run through gdb with "continue&", when it finally freezes, gdb will
only tell me that it is still running and trying to perform operations
gives "Target is executing.". My gdb-foo is way too low to deal with
this (unless someone would like to give me assistance in debugging it
further).

Since gdb was not much help, I have modified the code slightly in
hopes of others being able to reproduce. With this modification I can
produce a deadlock / freeze on every run.

--

child() {
    sleep 0.00001
    kill -USR1 $$
    sleep 0.0001
    kill -USR1 $$
}

TRAPUSR1() {
    sleep 0.000001
    print -n "."
}

for i in {1..10}; do
    child &!
done

sleep 0.0000001
sleep 0.000001
sleep 0.00001
sleep 0.0001
sleep 0.001


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-04 21:52       ` Mathias Fredriksson
  2015-08-05  0:05         ` Mathias Fredriksson
@ 2015-08-05  6:53         ` Bart Schaefer
  2015-08-05 10:37           ` Mathias Fredriksson
  1 sibling, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-05  6:53 UTC (permalink / raw)
  To: zsh-workers

On Aug 5, 12:52am, Mathias Fredriksson wrote:
}
} I have however managed to get a dump with strace on Gentoo

Based on this strace plus a GDB stack trace Mathias sent me off-list,
I think the problem may be here:

 1415 zwaitjob(int job, int wait_cmd)
 1416 {
 1417     int q = queue_signal_level();
 1418     Job jn = jobtab + job;
 1419 
 1420     dont_queue_signals();
 1421     child_block();               /* unblocked during signal_suspend() */
 1422     queue_traps(wait_cmd);
...
 1440         while (!errflag && jn->stat &&
 1441                !(jn->stat & STAT_DONE) &&
 1442                !(interact && (jn->stat & STAT_STOPPED))) {
 1443             signal_suspend(SIGCHLD, wait_cmd);

I suspect what's happening is that the child represented by "job" exits
during dont_queue_signals(), which is a macro that expands to a loop
calling zhandler(), which will process TRAPUSR1 (or other traps).

Somehow this results in jn->stat never being marked STAT_DONE.  Perhaps
this happens because the "thisjob" global gets temporarily changed in
the TRAP* function?  Anyway signal_suspend(SIGCHLD, wait_cmd) is then
called when there are no children left, so we never receive another
SIGCHLD to break out of the while-loop, and even if we do come out of
signal_suspend() the while-loop goes around and we block again.

I'm not sure what to do if this is in fact the problem, because it
e.g. calling child_block() is before dont_queue_signals() has other
problems.

However, it's also possible that a child has exited even before its
job table entry has been created.  One way to find out if that has
happened is this patch:

diff --git a/Src/signals.c b/Src/signals.c
index 3950ad1..d72c7d6 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -519,6 +519,7 @@ wait_for_processes(void)
 	     * will get added on to the next found process that
 	     * terminates.
 	     */
+	    zwarn("no job table entry for pid %d", pid);
 	    get_usage();
 	}
 	/*

Mathias, if you could apply that patch and try again to reproduce the
deadlock, it might tell us something.

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05  6:53         ` Bart Schaefer
@ 2015-08-05 10:37           ` Mathias Fredriksson
  2015-08-05 15:52             ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-05 10:37 UTC (permalink / raw)
  To: zsh-workers

On Wed, Aug 5, 2015 at 9:53 AM, Bart Schaefer wrote:
}
} Mathias, if you could apply that patch and try again to reproduce the
} deadlock, it might tell us something.

Of course, here's the output (as I see it in the terminal) with the
applied patch:

TRAPUSR1:1: no job table entry for pid 61571
TRAPUSR1:1: no job table entry for pid 61570
.TRAPUSR1:1: no job table entry for pid 61575
.TRAPUSR1:1: no job table entry for pid 61573
../deadlock.zsh:19: no job table entry for pid 61577
TRAPUSR1:1: no job table entry for pid 61581
.TRAPUSR1:1: no job table entry for pid 61595
TRAPUSR1:1: no job table entry for pid 61582
../deadlock.zsh:20: no job table entry for pid 61585
./deadlock.zsh:20: no job table entry for pid 61589
./deadlock.zsh:20: no job table entry for pid 61590

Furthermore, here is the gdb output from the last script I posted and
zsh built with --enable-zsh-debug:

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x0000000108fc05df in signal_suspend ()
#2  0x0000000108f97b05 in zwaitjob ()
#3  0x0000000108f97958 in waitjobs ()
#4  0x0000000108f7a90f in execpline ()
#5  0x0000000108f79c42 in execlist ()
#6  0x0000000108f79a6a in execode ()
#7  0x0000000108f920bb in loop ()
#8  0x0000000108f94d0c in zsh_main ()
#9  0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 10:37           ` Mathias Fredriksson
@ 2015-08-05 15:52             ` Bart Schaefer
  2015-08-05 16:05               ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-05 15:52 UTC (permalink / raw)
  To: zsh-workers

On Aug 5,  1:37pm, Mathias Fredriksson wrote:
} Subject: Re: Deadlock when receiving kill-signal from child process
}
} Of course, here's the output (as I see it in the terminal) with the
} applied patch:
} 
} TRAPUSR1:1: no job table entry for pid 61571

Aha.  Well, we can't leave that zwarn() in there because there are
legitimate cases where we fork without creating a job table entry,
but none of those cases should have occurred with your test script.

However, don't you delete it just yet from your test build.  Instead,
add this patch and see what you get.


diff --git a/Src/exec.c b/Src/exec.c
index 7612d43..29cc5cb 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1456,6 +1456,14 @@ execpline(Estate state, wordcode slcode, int how, int last1)
     else if (slflags & WC_SUBLIST_NOT)
 	last1 = 0;
 
+    /* If trap handlers are allowed to run here, they may start another
+     * external job in the middle of us starting this one, which can
+     * result in jobs being reaped before their job table entries have
+     * been initialized, which in turn leads to waiting forever for
+     * jobs that no longer exist.  So don't do that.
+     */
+    queue_signals();
+
     pj = thisjob;
     ipipe[0] = ipipe[1] = opipe[0] = opipe[1] = 0;
     child_block();
@@ -1468,6 +1476,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
      */
     if ((thisjob = newjob = initjob()) == -1) {
 	child_unblock();
+	unqueue_signals();
 	return 1;
     }
     if (how & Z_TIMED)
@@ -1523,6 +1532,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 	else
 	    spawnjob();
 	child_unblock();
+	unqueue_signals();
 	/* Executing background code resets shell status */
 	return lastval = 0;
     } else {
@@ -1580,7 +1590,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 		}
 		if (!(jn->stat & STAT_LOCKED)) {
 		    updated = hasprocs(thisjob);
-		    waitjobs();
+		    waitjobs();		/* deals with signal queue */
 		    child_block();
 		} else
 		    updated = 0;
@@ -1588,6 +1598,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 		    list_pipe_job && hasprocs(list_pipe_job) &&
 		    !(jobtab[list_pipe_job].stat & STAT_STOPPED)) {
 		    child_unblock();
+		    unqueue_signals();
+		    queue_signals();
 		    child_block();
 		}
 		if (list_pipe_child &&
@@ -1672,6 +1684,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 		    break;
 	    }
 	    child_unblock();
+	    unqueue_signals();
 
 	    if (list_pipe && (lastval & 0200) && pj >= 0 &&
 		(!(jn->stat & STAT_INUSE) || (jn->stat & STAT_DONE))) {

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 15:52             ` Bart Schaefer
@ 2015-08-05 16:05               ` Mathias Fredriksson
  2015-08-05 18:52                 ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-05 16:05 UTC (permalink / raw)
  To: zsh-workers

On Wed, Aug 5, 2015 at 6:52 PM, Bart Schaefer wrote:
}
} However, don't you delete it just yet from your test build.  Instead,
} add this patch and see what you get.

The freezes are now much less frequent, but I still managed to get it
to lock up with a slightly different gdb trace this time around.

Output:

./deadlock.zsh:15: no job table entry for pid 6501
./deadlock.zsh:15: no job table entry for pid 6500
./deadlock.zsh:15: no job table entry for pid 6503
./deadlock.zsh:15: no job table entry for pid 6505
./deadlock.zsh:15: no job table entry for pid 6509
TRAPUSR1:1: no job table entry for pid 6507
.....

gdb:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e1635 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x00000001036447d0 in zfork ()
#6  0x000000010364825d in execcmd ()
#7  0x00000001036432c0 in execpline ()
#8  0x000000010364286a in execlist ()
#9  0x0000000103642692 in execode ()
#10 0x0000000103646297 in runshfunc ()
#11 0x0000000103645d82 in doshfunc ()
#12 0x000000010368a8c7 in dotrapargs ()
#13 0x0000000103689a2a in handletrap ()
#14 0x0000000103689328 in zhandler ()
#15 <signal handler called>
#16 0x00007fff896dad62 in tiny_free_list_add_ptr ()
#17 0x00007fff896d9e7f in szone_free_definite_size ()
#18 0x000000010365e89a in inputsetline ()
#19 0x000000010365e1e7 in ingetc ()
#20 0x000000010366425b in zshlex ()
#21 0x0000000103679980 in parse_event ()
#22 0x000000010365add4 in loop ()
#23 0x000000010365dc2c in zsh_main ()
#24 0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 16:05               ` Mathias Fredriksson
@ 2015-08-05 18:52                 ` Bart Schaefer
  2015-08-05 19:11                   ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-05 18:52 UTC (permalink / raw)
  To: zsh-workers

On Aug 5,  7:05pm, Mathias Fredriksson wrote:
}
} The freezes are now much less frequent, but I still managed to get it
} to lock up with a slightly different gdb trace this time around.

Hm.  I'm a little puzzled by the continued appearance of the "no job
table entry" warning but this --

} #15 <signal handler called>
} #16 0x00007fff896dad62 in tiny_free_list_add_ptr ()
} #17 0x00007fff896d9e7f in szone_free_definite_size ()
} #18 0x000000010365e89a in inputsetline ()

-- is another case where we're manipulating global state without blocking
signal traps.


diff --git a/Src/input.c b/Src/input.c
index 1efabad..cabf942 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -377,6 +377,8 @@ inputline(void)
 static void
 inputsetline(char *str, int flags)
 {
+    queue_signals();
+
     if ((inbufflags & INP_FREE) && inbuf) {
 	free(inbuf);
     }
@@ -394,6 +396,8 @@ inputsetline(char *str, int flags)
     else
 	inbufct = inbufleft;
     inbufflags = flags;
+
+    unqueue_signals();
 }
 
 /*


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 18:52                 ` Bart Schaefer
@ 2015-08-05 19:11                   ` Mathias Fredriksson
  2015-08-05 20:20                     ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-05 19:11 UTC (permalink / raw)
  To: zsh-workers

On Wed, Aug 5, 2015 at 9:52 PM, Bart Schaefer wrote:
}
} Hm.  I'm a little puzzled by the continued appearance of the "no job
} table entry" warning but this --

Is it not explainable by disowning the child process (child &!)? At
least when I only do "child &" the error disappears.

By applying your last patch (in addition to the previous ones) I have
managed to produce two new stack traces, one where the last script is
run as-is and one where I do not disown the child processes.

child &! (disowned):

#0  0x00007fff8abfe166 in __psynch_mutexwait ()
#1  0x00007fff8e4b578a in _pthread_mutex_lock ()
#2  0x00007fff82ce5750 in fputc ()
#3  0x000000010c4d4d95 in zputs ()
#4  0x000000010c4d4bfc in mb_niceformat ()
#5  0x000000010c4d428d in zwarning ()
#6  0x000000010c4d4436 in zwarn ()
#7  0x000000010c4c8632 in wait_for_processes ()
#8  0x000000010c4c82fe in zhandler ()
#9  <signal handler called>
#10 0x00007fff8abfe72a in __sigsuspend ()
#11 0x000000010c4c84df in signal_suspend ()
#12 0x000000010c49fa05 in zwaitjob ()
#13 0x000000010c49f858 in waitjobs ()
#14 0x000000010c4825cc in execpline ()
#15 0x000000010c4817b2 in execlist ()
#16 0x000000010c4815da in execode ()
#17 0x000000010c4851df in runshfunc ()
#18 0x000000010c484cca in doshfunc ()
#19 0x000000010c4c98a7 in dotrapargs ()
#20 0x000000010c4c8a0a in handletrap ()
#21 0x000000010c4c8308 in zhandler ()
#22 <signal handler called>
#23 0x00007fff853a9340 in OSAtomicCompareAndSwapPtrBarrier$VARIANT$mp ()
#24 0x00007fff8e4b5714 in _pthread_mutex_lock ()
#25 0x00007fff82ce43a3 in ferror ()
#26 0x000000010c499f56 in loop ()
#27 0x000000010c49cb74 in zsh_main ()
#28 0x00007fff8610c5c9 in start ()

child & (no more "no job table entry" errors):

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e16d9 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x0000000105079718 in zfork ()
#6  0x000000010507d1a5 in execcmd ()
#7  0x0000000105078208 in execpline ()
#8  0x00000001050777b2 in execlist ()
#9  0x00000001050775da in execode ()
#10 0x000000010507b1df in runshfunc ()
#11 0x000000010507acca in doshfunc ()
#12 0x00000001050bf8a7 in dotrapargs ()
#13 0x00000001050bea0a in handletrap ()
#14 0x00000001050be308 in zhandler ()
#15 <signal handler called>
#16 0x00007fff896ddfc7 in small_free_list_add_ptr ()
#17 0x00007fff896d9ccf in szone_free_definite_size ()
#18 0x00000001050ae85c in init_parse ()
#19 0x00000001050ae965 in parse_event ()
#20 0x000000010508fd1c in loop ()
#21 0x0000000105092b74 in zsh_main ()
#22 0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 19:11                   ` Mathias Fredriksson
@ 2015-08-05 20:20                     ` Bart Schaefer
  2015-08-05 21:49                       ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-05 20:20 UTC (permalink / raw)
  To: zsh-workers

On Aug 5, 10:11pm, Mathias Fredriksson wrote:
} Subject: Re: Deadlock when receiving kill-signal from child process
}
} On Wed, Aug 5, 2015 at 9:52 PM, Bart Schaefer wrote:
} }
} } Hm.  I'm a little puzzled by the continued appearance of the "no job
} } table entry" warning but this --
} 
} Is it not explainable by disowning the child process (child &!)? At
} least when I only do "child &" the error disappears.

That explains the ./deadlock.zsh:... warnings but I didn't think it
explained the one that happened in TRAPUSR1.  Probably not significant.

} #0  0x00007fff8abfe166 in __psynch_mutexwait ()
} #1  0x00007fff8e4b578a in _pthread_mutex_lock ()
} #2  0x00007fff82ce5750 in fputc ()
} #9  <signal handler called>
} #23 0x00007fff853a9340 in OSAtomicCompareAndSwapPtrBarrier$VARIANT$mp ()
} #24 0x00007fff8e4b5714 in _pthread_mutex_lock ()
} #25 0x00007fff82ce43a3 in ferror ()

Dang.  Not sure there's much we can do about that one, that's the stdio
library deadlocking internally on a mutex because a signal arrived.
It'd be pretty ugly for us to try to wrap every stdio call with signal
blocking.


} #17 0x00007fff896d9ccf in szone_free_definite_size ()
} #18 0x00000001050ae85c in init_parse ()

Yet another one of these.  We may have to resort to treating all signals
the way we treat WINCH, that is, having them constantly queued except
for specific moments when we unqueue them.

diff --git a/Src/parse.c b/Src/parse.c
index 09567fd..84ebf85 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -456,6 +456,8 @@ init_parse_status(void)
 void
 init_parse(void)
 {
+    queue_signals();
+
     if (ecbuf) zfree(ecbuf, eclen);
 
     ecbuf = (Wordcode) zalloc((eclen = EC_INIT_SIZE) * sizeof(wordcode));
@@ -466,6 +468,8 @@ init_parse(void)
     ecnfunc = 0;
 
     init_parse_status();
+
+    unqueue_signals();
 }
 
 /* Build eprog. */

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 20:20                     ` Bart Schaefer
@ 2015-08-05 21:49                       ` Mathias Fredriksson
  2015-08-06  5:06                         ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-05 21:49 UTC (permalink / raw)
  To: zsh-workers

On Wed, Aug 5, 2015 at 11:20 PM, Bart Schaefer wrote:
}
} Dang.  Not sure there's much we can do about that one, that's the stdio
} library deadlocking internally on a mutex because a signal arrived.
} It'd be pretty ugly for us to try to wrap every stdio call with signal
} blocking.

Oh, interesting how this is only a problem on some systems.

}
} Yet another one of these.  We may have to resort to treating all signals
} the way we treat WINCH, that is, having them constantly queued except
} for specific moments when we unqueue them.

Ah, that explains why I have been able to work around this issue with WINCH.

}
} diff --git a/Src/parse.c b/Src/parse.c

Still locks up, interesting though is that this patch allows Ctrl+C to
exit the program even though it's frozen, the previous patch disabled
Ctrl+C, the one before that enabled Ctrl+C and before that it didn't
work either. Sorry for rambling, just trying to provide any additional
information I can.

forked child:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e16d9 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x000000010b9f6638 in zfork ()
#6  0x000000010b9fa0c5 in execcmd ()
#7  0x000000010b9f5128 in execpline ()
#8  0x000000010b9f46d2 in execlist ()
#9  0x000000010b9f44fa in execode ()
#10 0x000000010b9f80ff in runshfunc ()
#11 0x000000010b9f7bea in doshfunc ()
#12 0x000000010ba3c867 in dotrapargs ()
#13 0x000000010ba3b9ca in handletrap ()
#14 0x000000010ba3b2c8 in zhandler ()
#15 <signal handler called>
#16 0x00007fff896ddfc7 in small_free_list_add_ptr ()
#17 0x00007fff896d9ccf in szone_free_definite_size ()
#18 0x000000010ba2bc12 in bld_eprog ()
#19 0x000000010ba0cc3c in loop ()
#20 0x000000010ba0fa94 in zsh_main ()
#21 0x00007fff8610c5c9 in start ()

no fork:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896d98d6 in szone_free_definite_size ()
#3  0x000000010663c351 in freejob ()
#4  0x000000010663bd9d in printjob ()
#5  0x000000010663b0f2 in update_job ()
#6  0x0000000106665593 in wait_for_processes ()
#7  0x00000001066652be in zhandler ()
#8  <signal handler called>
#9  0x00007fff896d9e25 in szone_free_definite_size ()
#10 0x0000000106666885 in dotrapargs ()
#11 0x00000001066659ca in handletrap ()
#12 0x00000001066652c8 in zhandler ()
#13 0x000000010661fa29 in execpline ()
#14 0x000000010661e6d2 in execlist ()
#15 0x000000010661e4fa in execode ()
#16 0x0000000106636e43 in loop ()
#17 0x0000000106639a94 in zsh_main ()
#18 0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-05 21:49                       ` Mathias Fredriksson
@ 2015-08-06  5:06                         ` Bart Schaefer
  2015-08-06  8:24                           ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-06  5:06 UTC (permalink / raw)
  To: zsh-workers

I wrote:
} Yet another one of these.  We may have to resort to treating all signals
} the way we treat WINCH, that is, having them constantly queued except
} for specific moments when we unqueue them.

I played around with this a bit by hacking loop() but the effect is
that with the test script Mathais provided, most of the USR1 signals
are just thrown away (they collapse into a single call to the trap
handler).  Not sure if that's actually the desired effect.

On Aug 6, 12:49am, Mathias Fredriksson wrote:
}
} forked child:

You mean disowned, I presume, since all children are by definition forked.

} #18 0x000000010ba2bc12 in bld_eprog ()

Whack-a-mole continues.  Does the behavior change if you
	setopt NO_TRAPS_ASYNC
??

} #10 0x0000000106666885 in dotrapargs ()

The below might not be good enough -- it looks as if doshfunc() may need
to know internally about dont_queue_signals(), but other places that it is
called explictly unwrap it, so let's try that first.

Next question is how much are we slowing down the shell with all of this
signal management.


diff --git a/Src/parse.c b/Src/parse.c
index 09567fd..1a74164 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -488,6 +492,8 @@ bld_eprog(int heap)
     Eprog ret;
     int l;
 
+    queue_signals();
+
     ecadd(WCB_END());
 
     ret = heap ? (Eprog) zhalloc(sizeof(*ret)) : (Eprog) zalloc(sizeof(*ret));
@@ -511,6 +517,8 @@ bld_eprog(int heap)
     zfree(ecbuf, eclen);
     ecbuf = NULL;
 
+    unqueue_signals();
+
     return ret;
 }
 
diff --git a/Src/signals.c b/Src/signals.c
index 3950ad1..852f612 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -1219,6 +1219,10 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
     if (*sigtr & ZSIG_FUNC) {
 	int osc = sfcontext, old_incompfunc = incompfunc;
 	HashNode hn = gettrapnode(sig, 0);
+	int q;
+
+	queue_signals();	/* Any time we manage memory */
+	q = queue_signal_level();
 
 	args = znewlinklist();
 	/*
@@ -1244,11 +1248,14 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
 
 	sfcontext = SFC_SIGNAL;
 	incompfunc = 0;
+	dont_queue_signals();
 	doshfunc((Shfunc)sigfn, args, 1);
+	restore_queue_signals(q);
 	sfcontext = osc;
 	incompfunc= old_incompfunc;
 	freelinklist(args, (FreeFunc) NULL);
 	zsfree(name);
+	unqueue_signals();
     } else {
 	trap_return = -2;	/* not incremented, used at current level */
 	trap_state = TRAP_STATE_PRIMED;


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-06  5:06                         ` Bart Schaefer
@ 2015-08-06  8:24                           ` Mathias Fredriksson
  2015-08-06 15:54                             ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-06  8:24 UTC (permalink / raw)
  To: zsh-workers

On Thu, Aug 6, 2015 at 8:06 AM, Bart Schaefer wrote:
}
} I played around with this a bit by hacking loop() but the effect is
} that with the test script Mathais provided, most of the USR1 signals
} are just thrown away (they collapse into a single call to the trap
} handler).  Not sure if that's actually the desired effect.

I would imagine some might rely on every signal being handled, e.g.
keeping a count.

}
} You mean disowned, I presume, since all children are by definition forked.

Yes, sorry for being unclear.

}
} Whack-a-mole continues.  Does the behavior change if you
}         setopt NO_TRAPS_ASYNC
} ??

Heh, that's exactly what this feels like. But I don't think it changes
the behavior, this is pre-patch with NO_TRAPS_ASYNC set:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e16d9 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x00000001074b166c in zfork ()
#6  0x00000001074b50f9 in execcmd ()
#7  0x00000001074b015c in execpline ()
#8  0x00000001074af706 in execlist ()
#9  0x00000001074af52e in execode ()
#10 0x00000001074b3133 in runshfunc ()
#11 0x00000001074b2c1e in doshfunc ()
#12 0x00000001074f788a in dotrapargs ()
#13 0x00000001074f69ed in handletrap ()
#14 0x00000001074f62fc in zhandler ()
#15 <signal handler called>
#16 0x00007fff896ddfc7 in small_free_list_add_ptr ()
#17 0x00007fff896d9ccf in szone_free_definite_size ()
#18 0x00000001074e6c46 in bld_eprog ()
#19 0x00000001074c7c70 in loop ()
#20 0x00000001074caac8 in zsh_main ()
#21 0x00007fff8610c5c9 in start ()

}
} Next question is how much are we slowing down the shell with all of this
} signal management.

By just casual observation I can't tell a difference. I guess proper
benchmarks would be required.

The following traces have the last patches applied (I did multiple
runs to see if I could hit different states):

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896d771b in szone_malloc_should_clear ()
#3  0x00007fff896d7667 in malloc_zone_malloc ()
#4  0x00007fff896d6187 in malloc ()
#5  0x000000010df5deaf in zalloc ()
#6  0x000000010df7e2ca in ztrdup ()
#7  0x000000010df889b3 in mb_niceformat ()
#8  0x000000010df881cd in zwarning ()
#9  0x000000010df88376 in zwarn ()
#10 0x000000010df7c3da in wait_for_processes ()
#11 0x000000010df7c0a6 in zhandler ()
#12 <signal handler called>
#13 0x00007fff896dad62 in tiny_free_list_add_ptr ()
#14 0x00007fff896d9e7f in szone_free_definite_size ()
#15 0x000000010df38e63 in runshfunc ()
#16 0x000000010df38936 in doshfunc ()
#17 0x000000010df7d70b in dotrapargs ()
#18 0x000000010df7c7b2 in handletrap ()
#19 0x000000010df7c0b0 in zhandler ()
#20 0x000000010df36775 in execpline ()
#21 0x000000010df3541e in execlist ()
#22 0x000000010df35246 in execode ()
#23 0x000000010df4db8f in loop ()
#24 0x000000010df507e0 in zsh_main ()
#25 0x00007fff8610c5c9 in start ()

--

#0  0x00007fff8abfe166 in __psynch_mutexwait ()
#1  0x00007fff8e4b578a in _pthread_mutex_lock ()
#2  0x00007fff82ce5750 in fputc ()
#3  0x000000010b17ccd5 in zputs ()
#4  0x000000010b17cb3c in mb_niceformat ()
#5  0x000000010b17c1cd in zwarning ()
#6  0x000000010b17c376 in zwarn ()
#7  0x000000010b1703da in wait_for_processes ()
#8  0x000000010b1700a6 in zhandler ()
#9  <signal handler called>
#10 0x00007fff8abfe72a in __sigsuspend ()
#11 0x000000010b170287 in signal_suspend ()
#12 0x000000010b147671 in zwaitjob ()
#13 0x000000010b1474c4 in waitjobs ()
#14 0x000000010b12a238 in execpline ()
#15 0x000000010b12941e in execlist ()
#16 0x000000010b129246 in execode ()
#17 0x000000010b12ce4b in runshfunc ()
#18 0x000000010b12c936 in doshfunc ()
#19 0x000000010b17170b in dotrapargs ()
#20 0x000000010b1707b2 in handletrap ()
#21 0x000000010b1700b0 in zhandler ()
#22 <signal handler called>
#23 0x00007fff8abfe166 in __psynch_mutexwait ()
#24 0x00007fff8e4b578a in _pthread_mutex_lock ()
#25 0x00007fff82ce5750 in fputc ()
#26 0x000000010b17ccd5 in zputs ()
#27 0x000000010b17cb3c in mb_niceformat ()
#28 0x000000010b17c1cd in zwarning ()
#29 0x000000010b17c376 in zwarn ()
#30 0x000000010b1703da in wait_for_processes ()
#31 0x000000010b1700a6 in zhandler ()
#32 <signal handler called>
#33 0x00007fff853a9340 in OSAtomicCompareAndSwapPtrBarrier$VARIANT$mp ()
#34 0x00007fff8e4b5714 in _pthread_mutex_lock ()
#35 0x00007fff82ce43a3 in ferror ()
#36 0x000000010b141bc2 in loop ()
#37 0x000000010b1447e0 in zsh_main ()
#38 0x00007fff8610c5c9 in start ()

setopt NO_ASYNC_TRAPS:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896d771b in szone_malloc_should_clear ()
#3  0x00007fff896d7667 in malloc_zone_malloc ()
#4  0x00007fff896d6187 in malloc ()
#5  0x00000001081e2eaf in zalloc ()
#6  0x00000001082032ca in ztrdup ()
#7  0x000000010820d9b3 in mb_niceformat ()
#8  0x000000010820d1cd in zwarning ()
#9  0x000000010820d376 in zwarn ()
#10 0x00000001082013da in wait_for_processes ()
#11 0x00000001082010a6 in zhandler ()
#12 <signal handler called>
#13 0x00007fff896da116 in szone_free_definite_size ()
#14 0x00000001081bde63 in runshfunc ()
#15 0x00000001081bd936 in doshfunc ()
#16 0x000000010820270b in dotrapargs ()
#17 0x00000001082017b2 in handletrap ()
#18 0x00000001082029ec in unqueue_traps ()
#19 0x00000001081d872b in zwaitjob ()
#20 0x00000001081d84c4 in waitjobs ()
#21 0x00000001081bb238 in execpline ()
#22 0x00000001081ba41e in execlist ()
#23 0x00000001081ba246 in execode ()
#24 0x00000001081d2b8f in loop ()
#25 0x00000001081d57e0 in zsh_main ()
#26 0x00007fff8610c5c9 in start ()

--

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x000000010af61287 in signal_suspend ()
#2  0x000000010af38671 in zwaitjob ()
#3  0x000000010af384c4 in waitjobs ()
#4  0x000000010af1b238 in execpline ()
#5  0x000000010af1a41e in execlist ()
#6  0x000000010af1a246 in execode ()
#7  0x000000010af1de4b in runshfunc ()
#8  0x000000010af1d936 in doshfunc ()
#9  0x000000010af6270b in dotrapargs ()
#10 0x000000010af617b2 in handletrap ()
#11 0x000000010af610b0 in zhandler ()
#12 <signal handler called>
#13 0x00007fff82ce43a8 in ferror ()
#14 0x000000010af32bc2 in loop ()
#15 0x000000010af357e0 in zsh_main ()
#16 0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-06  8:24                           ` Mathias Fredriksson
@ 2015-08-06 15:54                             ` Bart Schaefer
  2015-08-07  0:45                               ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-06 15:54 UTC (permalink / raw)
  To: zsh-workers

On Aug 6, 11:24am, Mathias Fredriksson wrote:
} Subject: Re: Deadlock when receiving kill-signal from child process
}
} On Thu, Aug 6, 2015 at 8:06 AM, Bart Schaefer wrote:
} }
} } I played around with this a bit by hacking loop() but the effect is
} } that with the test script Mathais provided, most of the USR1 signals
} } are just thrown away (they collapse into a single call to the trap
} } handler).  Not sure if that's actually the desired effect.
} 
} I would imagine some might rely on every signal being handled, e.g.
} keeping a count.

Even without spending most of the time in queuing, *some* of the signals
get dropped at the OS level.  The only way I can get them all to be
tallied is to remove the "sleep" from the trap function.

} The following traces have the last patches applied (I did multiple
} runs to see if I could hit different states):
} 
} #15 0x000000010df38e63 in runshfunc ()
} #16 0x000000010df38936 in doshfunc ()

This is confirms my suspicion about doshfunc().  Sadly it's called all
over the place, sometimes with signals explicitly un-queued and other
times with no change to the surrounding context.

} #0  0x00007fff8abfe166 in __psynch_mutexwait ()
} #1  0x00007fff8e4b578a in _pthread_mutex_lock ()
} #2  0x00007fff82ce5750 in fputc ()
} #9  <signal handler called>
} #22 <signal handler called>
} #32 <signal handler called>
} #34 0x00007fff8e4b5714 in _pthread_mutex_lock ()
} #35 0x00007fff82ce43a3 in ferror ()

This is the stdio thing again.  Anyone reading this familar enough with
the POSIX or C standards to point to whether stdio is required to be
signal-safe with pthreads?  I.e., is this our bug or someone else's?

(Not that zsh is using threads, but stdio is using pthread mutexes.)

} setopt NO_ASYNC_TRAPS:

NO_TRAPS_ASYNC ?

Anyway, same two issues as above, just slightly different paths (no
multiple signal handers in the stdio case, but one is enough).

As with the previous dotrapargs() patch, I'm a little nervous about
the dont_queue_signals() bits, but that's the only safe way to do
the disabling part of signal queueing when the enabling part is not
in local scope.

diff --git a/Src/exec.c b/Src/exec.c
index 7612d43..2886785 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4820,11 +4833,9 @@ execshfunc(Shfunc shf, LinkList args)
     if ((osfc = sfcontext) == SFC_NONE)
 	sfcontext = SFC_DIRECT;
     xtrerr = stderr;
-    unqueue_signals();
 
     doshfunc(shf, args, 0);
 
-    queue_signals();
     sfcontext = osfc;
     free(cmdstack);
     cmdstack = ocs;
@@ -5039,6 +5050,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     static int funcdepth;
 #endif
 
+    queue_signals();	/* Lots of memory and global state changes coming */
+
     pushheap();
 
     oargv0 = NULL;
@@ -5261,6 +5274,8 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     }
     popheap();
 
+    unqueue_signals();
+
     /*
      * Exit with a tidy up.
      * Only leave if we're at the end of the appropriate function ---
@@ -5296,7 +5311,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
 mod_export void
 runshfunc(Eprog prog, FuncWrap wrap, char *name)
 {
-    int cont, ouu;
+    int cont, ouu, q = queue_signal_level();
     char *ou;
 
     ou = zalloc(ouu = underscoreused);
@@ -5305,7 +5320,9 @@ runshfunc(Eprog prog, FuncWrap wrap, char *name)
 
     while (wrap) {
 	wrap->module->wrapper++;
+	dont_queue_signals();
 	cont = wrap->handler(prog, wrap->next, name);
+	restore_queue_signals(q);
 	wrap->module->wrapper--;
 
 	if (!wrap->module->wrapper &&
@@ -5320,7 +5337,9 @@ runshfunc(Eprog prog, FuncWrap wrap, char *name)
 	wrap = wrap->next;
     }
     startparamscope();
+    dont_queue_signals();
     execode(prog, 1, 0, "shfunc");
+    restore_queue_signals(q);
     if (ou) {
 	setunderscore(ou);
 	zfree(ou, ouu);


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-06 15:54                             ` Bart Schaefer
@ 2015-08-07  0:45                               ` Mathias Fredriksson
  2015-08-07  5:39                                 ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-07  0:45 UTC (permalink / raw)
  To: zsh-workers

On Thu, Aug 6, 2015 at 6:54 PM, Bart Schaefer wrote:
}
} This is the stdio thing again.  Anyone reading this familar enough with
} the POSIX or C standards to point to whether stdio is required to be
} signal-safe with pthreads?  I.e., is this our bug or someone else's?

Sadly I can't be of much assistance here, I believe you can't call
pthread mutexes from a signal handler, but that isn't whats happening
here? If I understand correctly a signal is received while a mutex
lock is (being) aquired.

}
} NO_TRAPS_ASYNC ?

Yes, my bad, typo in the email message, used the correct setopt.

}
} As with the previous dotrapargs() patch, I'm a little nervous about
} the dont_queue_signals() bits, but that's the only safe way to do
} the disabling part of signal queueing when the enabling part is not
} in local scope.

I'm not quite sure I understand what these changes do, but at least
this last patch made it a lot harder for me to have zsh lock up. I had
to leave my script running in a while true; do ...; done loop
(eventually, 30sec-10min it would hit a lock).

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x0000000107b59287 in signal_suspend ()
#2  0x0000000107b30671 in zwaitjob ()
#3  0x0000000107b304c4 in waitjobs ()
#4  0x0000000107b130e8 in execpline ()
#5  0x0000000107b122ce in execlist ()
#6  0x0000000107b120f6 in execode ()
#7  0x0000000107b15ebf in runshfunc ()
#8  0x0000000107b157f4 in doshfunc ()
#9  0x0000000107b5a70b in dotrapargs ()
#10 0x0000000107b597b2 in handletrap ()
#11 0x0000000107b590b0 in zhandler ()
#12 <signal handler called>
#13 0x00007fff82ce43a8 in ferror ()
#14 0x0000000107b2abc2 in loop ()
#15 0x0000000107b2d7e0 in zsh_main ()
#16 0x00007fff8610c5c9 in start ()

This just seems like the same mutex stuff again:

#0  0x00007fff8abfe166 in __psynch_mutexwait ()
#1  0x00007fff8e4b578a in _pthread_mutex_lock ()
#2  0x00007fff82ce5750 in fputc ()
#3  0x0000000102c20cd5 in zputs ()
#4  0x0000000102c20b3c in mb_niceformat ()
#5  0x0000000102c201cd in zwarning ()
#6  0x0000000102c20376 in zwarn ()
#7  0x0000000102c143da in wait_for_processes ()
#8  0x0000000102c140a6 in zhandler ()
#9  <signal handler called>
#10 0x00007fff8abfe72a in __sigsuspend ()

This also looks vaguely familiar but might as well post it:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896d771b in szone_malloc_should_clear ()
#3  0x00007fff896d7667 in malloc_zone_malloc ()
#4  0x00007fff896d6187 in malloc ()
#5  0x0000000101ccdeaf in zalloc ()
#6  0x0000000101cee2ca in ztrdup ()
#7  0x0000000101cf89b3 in mb_niceformat ()
#8  0x0000000101cf81cd in zwarning ()
#9  0x0000000101cf8376 in zwarn ()
#10 0x0000000101cec3da in wait_for_processes ()
#11 0x0000000101cec0a6 in zhandler ()
#12 <signal handler called>
#13 0x00007fff853aacd1 in _os_lock_spin_lock ()
#14 0x00007fff896d98d6 in szone_free_definite_size ()
#15 0x0000000101ca5874 in execlist ()
#16 0x0000000101ca50f6 in execode ()
#17 0x0000000101ca8ebf in runshfunc ()
#18 0x0000000101ca87f4 in doshfunc ()
#19 0x0000000101ced70b in dotrapargs ()
#20 0x0000000101cec7b2 in handletrap ()
#21 0x0000000101ced9ec in unqueue_traps ()
#22 0x0000000101cc372b in zwaitjob ()
#23 0x0000000101cc34c4 in waitjobs ()
#24 0x0000000101ca60e8 in execpline ()
#25 0x0000000101ca52ce in execlist ()
#26 0x0000000101ccaad0 in execwhile ()
#27 0x0000000101cac0d9 in execcmd ()
#28 0x0000000101ca5d24 in execpline ()
#29 0x0000000101ca52ce in execlist ()
#30 0x0000000101ca50f6 in execode ()
#31 0x0000000101cbdb8f in loop ()
#32 0x0000000101cc07e0 in zsh_main ()
#33 0x00007fff8610c5c9 in start ()

Bonus NO_TRAPS_ASYNC:

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x0000000107509287 in signal_suspend ()
#2  0x00000001074e0671 in zwaitjob ()
#3  0x00000001074e04c4 in waitjobs ()
#4  0x00000001074c30e8 in execpline ()
#5  0x00000001074c22ce in execlist ()
#6  0x00000001074c20f6 in execode ()
#7  0x00000001074c5ebf in runshfunc ()
#8  0x00000001074c57f4 in doshfunc ()
#9  0x000000010750a70b in dotrapargs ()
#10 0x00000001075097b2 in handletrap ()
#11 0x00000001075090b0 in zhandler ()
#12 <signal handler called>
#13 0x00007fff8abfe97a in write$NOCANCEL ()
#14 0x00007fff82ceb9ed in _swrite ()
#15 0x00007fff82ce44a7 in __sflush ()
#16 0x00007fff82ce43f5 in fflush ()
#17 0x0000000107515376 in zwarn ()
#18 0x00000001075093da in wait_for_processes ()
#19 0x00000001075090a6 in zhandler ()
#20 <signal handler called>
#21 0x00007fff8abffa12 in sigprocmask ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-07  0:45                               ` Mathias Fredriksson
@ 2015-08-07  5:39                                 ` Bart Schaefer
  2015-08-09 13:53                                   ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-07  5:39 UTC (permalink / raw)
  To: zsh-workers

On Aug 7,  3:45am, Mathias Fredriksson wrote:
}
} Sadly I can't be of much assistance here, I believe you can't call
} pthread mutexes from a signal handler

If true, that would mean either (a) you can't use stdio functions from
a signal handler, because this implementation of stdio is using pthread
mutexes, or (b) stdio is not allowed to use pthread mutexes, so this 
implementation is broken.

} but that isn't whats happening
} here? If I understand correctly a signal is received while a mutex
} lock is (being) aquired.

Specifially ferror() is attempting to acquire a mutex lock when the
signal arrives, and then the handler calls fputc() which tries to
acquire the same lock, and: clunk.

} I'm not quite sure I understand what these changes do

queue_signals() increments a counter that is tested in the signal
handler.  If the counter is nonzero, the handler does nothing but
make note in a static array that the signal was received.  If too
many signals arrive before there is an opportunity to empty the
array, the excess are simply dropped.  (The default is to be able
to queue 128 signals before starting to lose some -- if you're
expecting the shell to handle massive numbers of signals arriving
in quick succession, you're using the wrong tool for your job.
Further, this is another reason I'm reluctant to adopt the WINCH
approach for signals in general.)

dont_queue_signals() forces the counter to zero and calls all the
shell function handlers for the signals in the static array, in the
order the signals were recorded.

restore_queue_signals() sets the counter back to some previous state
(obtained from queue_signal_level()).

unqueue_signals() decrements the counter and calls all the shell
functions if (when) it reaches zero.

Using the counter means that you can have arbitrarily deep nesting of
queue_signals().  Using dont_queue_signals() implies that it is known
to be safe to run the handlers at that time, because it unwinds all
those levels of nesting at once.

So anytime I find myself using dont_queue_signals() I worry that there
is a calling scope reason avoid signal handlers.  On the other hand,
if it's safe to run shell code at all (e.g., runshfunc()), it should
also be safe to run signal traps.

} but at least
} this last patch made it a lot harder for me to have zsh lock up. I had
} to leave my script running in a while true; do ...; done loop
} (eventually, 30sec-10min it would hit a lock).
} 
} #0  0x00007fff8abfe72a in __sigsuspend ()
} #1  0x0000000107b59287 in signal_suspend ()
} #2  0x0000000107b30671 in zwaitjob ()

Sigh.  That looks like another case of waiting for a child that does
not exist.  Unfortunately this time the call stack beyond here does
not hint at where that job was started.  Might need another strace
that corresponds to this backtrace.

} This just seems like the same mutex stuff again:
} 
} #0  0x00007fff8abfe166 in __psynch_mutexwait ()
} #1  0x00007fff8e4b578a in _pthread_mutex_lock ()
} #2  0x00007fff82ce5750 in fputc ()
} #3  0x0000000102c20cd5 in zputs ()
} #4  0x0000000102c20b3c in mb_niceformat ()
} #5  0x0000000102c201cd in zwarning ()
} #6  0x0000000102c20376 in zwarn ()
} #7  0x0000000102c143da in wait_for_processes ()
} #8  0x0000000102c140a6 in zhandler ()
} #9  <signal handler called>
} #10 0x00007fff8abfe72a in __sigsuspend ()

The stack must go further than this?  What called __sigsuspend() ?


} This also looks vaguely familiar but might as well post it:
} 
} #0  0x00007fff8abf95da in syscall_thread_switch ()
} #1  0x00007fff853a982d in _OSSpinLockLockSlow ()
} #2  0x00007fff896d771b in szone_malloc_should_clear ()

Yeah, this is a signal arriving during memory allocation.  Looks like
it came from here:

} #14 0x00007fff896d98d6 in szone_free_definite_size ()
} #15 0x0000000101ca5874 in execlist ()

So we definitely need queue_signals() somewhere down in the guts of
execlist().  Which means rejiggering some of the stuff from previous
patches, so I think I'd better back up and send a new patch against
the git master.

What next concerns me is being sure that signals are unqueued often
enough that interrupts still work, etc.


} Bonus NO_TRAPS_ASYNC:
} 
} #0  0x00007fff8abfe72a in __sigsuspend ()
} #1  0x0000000107509287 in signal_suspend ()
} #11 0x00000001075090b0 in zhandler ()
} #12 <signal handler called>
} #13 0x00007fff8abfe97a in write$NOCANCEL ()
} #14 0x00007fff82ceb9ed in _swrite ()
} #15 0x00007fff82ce44a7 in __sflush ()
} #16 0x00007fff82ce43f5 in fflush ()
} #17 0x0000000107515376 in zwarn ()
} #18 0x00000001075093da in wait_for_processes ()
} #19 0x00000001075090a6 in zhandler ()
} #20 <signal handler called>
} #21 0x00007fff8abffa12 in sigprocmask ()

This trace must also go further?  The part shown is calling a handler
while during fflush() in a previous handler, but the trace doesn't
go back far enough to see where the first handler was called.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-07  5:39                                 ` Bart Schaefer
@ 2015-08-09 13:53                                   ` Mathias Fredriksson
  2015-08-09 23:42                                     ` Bart Schaefer
  2015-08-10 19:34                                     ` Bart Schaefer
  0 siblings, 2 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-09 13:53 UTC (permalink / raw)
  To: zsh-workers

First off, great work on the last patch (zsh-workers 36022) Bart! I've
been testing now with the latest git master and applied said patch on
top. At first I thought there were absolutely no more deadlocks, but I
managed to repeatedly produce one (when _not_ disowning the child
processes). I'm wondering if I'm not getting the complete picture
though since there are some "in ?? ()" also in there (I did build with
debugging enabled though).

My configure options for reference:

--enable-cap
--enable-multibyte
--enable-maildir-support
--with-tcsetpgrp
--enable-zsh-debug
--enable-zsh-mem-debug
--enable-zsh-mem-warning
--enable-zsh-secure-free
--enable-zsh-hash-debug

Trace:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e1635 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x0000000105d3f960 in get_match_ret ()
#6  0x0000000105d45463 in savehistfile ()
#7  0x0000000105d42b4f in iaddtoline ()
#8  0x0000000105d3d69f in gmatchcmp ()
#9  0x0000000105d3c6ce in qualisdev ()
#10 0x0000000105d3bff5 in zglob ()
#11 0x0000000105d423e8 in histstrcmp ()
#12 0x0000000105d41db3 in printreswdnode ()
#13 0x0000000105dba726 in ?? ()
#14 0x0000000105dbac89 in ?? ()
#15 0x0000000105db91ef in ?? ()
#16 0x0000000105db8839 in ?? ()
#17 <signal handler called>
#18 0x00007fff896db4fe in tiny_free_list_remove_ptr ()
#19 0x00007fff896d9b2e in szone_free_definite_size ()
#20 0x0000000105d82ef6 in getredirs ()
#21 0x0000000105d70231 in patmatch ()
#22 0x0000000105d6fd7b in patmatch ()
#23 0x0000000105d6f8d7 in pattryrefs ()
#24 0x0000000105d6e105 in patcompile ()
#25 0x0000000105db8d7d in ?? ()
#26 0x0000000105db85bf in ?? ()
#27 0x0000000105d3cf36 in scanner ()
#28 0x0000000105d7bf51 in paramsubst ()
#29 0x0000000105d47389 in chrealpath ()
#30 0x0000000105d42b4f in iaddtoline ()
#31 0x0000000105d3d69f in gmatchcmp ()
#32 0x0000000105d3c6ce in qualisdev ()
#33 0x0000000105d7ce45 in paramsubst ()
#34 0x0000000105d47389 in chrealpath ()
#35 0x0000000105d42b4f in iaddtoline ()
#36 0x0000000105d3d69f in gmatchcmp ()
#37 0x0000000105d3c6ce in qualisdev ()
#38 0x0000000105d3bff5 in zglob ()
#39 0x0000000105d66d6a in histcharssetfn ()
#40 0x0000000105d6b0f2 in par_cond_2 ()
#41 0x0000000105d1e9b2 in _mh_execute_header ()
#42 0x00007fff8610c5c9 in start ()

On Fri, Aug 7, 2015 at 8:39 AM, Bart Schaefer wrote:
}
} Specifially ferror() is attempting to acquire a mutex lock when the
} signal arrives, and then the handler calls fputc() which tries to
} acquire the same lock, and: clunk.

Aha, ok.

}
} So anytime I find myself using dont_queue_signals() I worry that there
} is a calling scope reason avoid signal handlers.  On the other hand,
} if it's safe to run shell code at all (e.g., runshfunc()), it should
} also be safe to run signal traps.

Thanks for the thorough walkthrough, I understand it a bit better now!

}
} The stack must go further than this?  What called __sigsuspend() ?

Actually that is all that I got out from gdb, I'll try to dig deeper
somehow (if it's possible) next time it happens.

}
} This trace must also go further?  The part shown is calling a handler
} while during fflush() in a previous handler, but the trace doesn't
} go back far enough to see where the first handler was called.

Same as previous, this was all that I got out from gdb.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-09 13:53                                   ` Mathias Fredriksson
@ 2015-08-09 23:42                                     ` Bart Schaefer
  2015-08-10  0:02                                       ` Mikael Magnusson
  2015-08-10  0:29                                       ` Bart Schaefer
  2015-08-10 19:34                                     ` Bart Schaefer
  1 sibling, 2 replies; 41+ messages in thread
From: Bart Schaefer @ 2015-08-09 23:42 UTC (permalink / raw)
  To: zsh-workers

On Aug 9,  4:53pm, Mathias Fredriksson wrote:
} Subject: Re: Deadlock when receiving kill-signal from child process
}
} I'm wondering if I'm not getting the complete picture
} though since there are some "in ?? ()" also in there (I did build with
} debugging enabled though).

Did you "make install" before running this?  If so, *don't* -- run the
binary straight out of the build tree.  If you "make install" the symbol
table gets stripped even if you've compiled with debugging, which gives
you the incomplete stack traces you've been seeing.

In this case I think that's actually causing a misleading backtrace,
because:

} #17 <signal handler called>
} #18 0x00007fff896db4fe in tiny_free_list_remove_ptr ()
} #19 0x00007fff896d9b2e in szone_free_definite_size ()
} #20 0x0000000105d82ef6 in getredirs ()

There is already a queue_signals() around getredirs() so it should not
be calling a signal handler here, or at least the handler should not
be doing anything interesting.

Also this part doesn't make sense:

} #0  0x00007fff8abf95da in syscall_thread_switch ()
} #1  0x00007fff853a982d in _OSSpinLockLockSlow ()
} #2  0x00007fff896e1635 in szone_force_lock ()
} #3  0x00007fff896e15e6 in _malloc_fork_prepare ()
} #4  0x00007fff82cb8097 in fork ()
} #5  0x0000000105d3f960 in get_match_ret ()
} #6  0x0000000105d45463 in savehistfile ()

There's no call to get_match_ret() from savehistfile(), and it's pretty
unlikely that savehistfile is called at all, so this stack looks trashed
to me.  (My other guess would be you're using the new binary with an old
core file, but theoretically you're not reading a core file at all).

Also here:

} #36 0x0000000105d3d69f in gmatchcmp ()
} #37 0x0000000105d3c6ce in qualisdev ()

qualisdev() doesn't call anything.  Stack definitely hosed.

Nevertheless, it looks like glob.c needs to protect some places where
it manipulates global state.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-09 23:42                                     ` Bart Schaefer
@ 2015-08-10  0:02                                       ` Mikael Magnusson
  2015-08-10  0:16                                         ` Mathias Fredriksson
  2015-08-10  0:36                                         ` Bart Schaefer
  2015-08-10  0:29                                       ` Bart Schaefer
  1 sibling, 2 replies; 41+ messages in thread
From: Mikael Magnusson @ 2015-08-10  0:02 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh workers

On Mon, Aug 10, 2015 at 1:42 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Aug 9,  4:53pm, Mathias Fredriksson wrote:
> } Subject: Re: Deadlock when receiving kill-signal from child process
> }
> } I'm wondering if I'm not getting the complete picture
> } though since there are some "in ?? ()" also in there (I did build with
> } debugging enabled though).
>
> Did you "make install" before running this?  If so, *don't* -- run the
> binary straight out of the build tree.  If you "make install" the symbol
> table gets stripped even if you've compiled with debugging, which gives
> you the incomplete stack traces you've been seeing.

I don't think this is the case, there's a separate install-strip
target for that. I've always done make install and ran gdb on the
resulting install successfully. There's also a caveat with running the
in-tree binary: all modules loaded will still be from $PREFIX, not the
build directory.

-- 
Mikael Magnusson


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10  0:02                                       ` Mikael Magnusson
@ 2015-08-10  0:16                                         ` Mathias Fredriksson
  2015-08-10  1:47                                           ` Bart Schaefer
  2015-08-10  0:36                                         ` Bart Schaefer
  1 sibling, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-10  0:16 UTC (permalink / raw)
  To: zsh-workers

On Mon, Aug 10, 2015 at 3:02 AM, Mikael Magnusson wrote:
} I don't think this is the case, there's a separate install-strip
} target for that. I've always done make install and ran gdb on the
} resulting install successfully. There's also a caveat with running the
} in-tree binary: all modules loaded will still be from $PREFIX, not the
} build directory.

I'm thinking this might be correct, at least doing a "make clean &&
make" and running from Src/zsh did not give any more meaningful
output:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896d771b in szone_malloc_should_clear ()
#3  0x00007fff896d7667 in malloc_zone_malloc ()
#4  0x00007fff896d6187 in malloc ()
#5  0x000000010393334a in zglob ()
#6  0x000000010393350e in zglob ()
#7  0x00000001039b26ba in ?? ()
#8  0x00000001039b2de9 in ?? ()
#9  0x00000001039b134f in ?? ()
#10 0x00000001039b0999 in ?? ()
#11 <signal handler called>
#12 0x00007fff896dad6d in tiny_free_list_add_ptr ()
#13 0x00007fff896d9e7f in szone_free_definite_size ()
#14 0x000000010397b096 in taddstr ()
#15 0x0000000103968451 in patmatch ()
#16 0x0000000103967f9b in patmatch ()
#17 0x0000000103967af7 in patmatch ()
#18 0x0000000103966325 in patcompile ()
#19 0x00000001039b0edd in ?? ()
#20 0x00000001039b071f in ?? ()
#21 0x00000001039355e6 in gmatchcmp ()
#22 0x0000000103974171 in paramsubst ()
#23 0x000000010393fa39 in casemodify ()
#24 0x000000010393b1ff in hend ()
#25 0x0000000103935d4f in bracechardots ()
#26 0x0000000103934d7e in scanner ()
#27 0x0000000103975065 in paramsubst ()
#28 0x000000010393fa39 in casemodify ()
#29 0x000000010393b1ff in hend ()
#30 0x0000000103935d4f in bracechardots ()
#31 0x0000000103934d7e in scanner ()
#32 0x00000001039346a5 in qualisblk ()
#33 0x000000010395ef8a in zputenv ()
#34 0x0000000103963312 in par_cond_triple ()
#35 0x0000000103917062 in _mh_execute_header ()
#36 0x00007fff8610c5c9 in start ()

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e1635 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x000000010ee06010 in insert ()
#6  0x000000010ee0bb13 in histreduceblanks ()
#7  0x000000010ee091ff in hend ()
#8  0x000000010ee03d4f in bracechardots ()
#9  0x000000010ee02d7e in scanner ()
#10 0x000000010ee026a5 in qualisblk ()
#11 0x000000010ee08a98 in iaddtoline ()
#12 0x000000010ee08463 in addhistnode ()
#13 0x000000010ee80886 in ?? ()
#14 0x000000010ee80de9 in ?? ()
#15 0x000000010ee7f34f in ?? ()
#16 0x000000010ee7e999 in ?? ()
#17 <signal handler called>
#18 0x00007fff896db4fe in tiny_free_list_remove_ptr ()
#19 0x00007fff896d9b2e in szone_free_definite_size ()
#20 0x000000010ee49096 in taddstr ()
#21 0x000000010ee36451 in patmatch ()
#22 0x000000010ee35f9b in patmatch ()
#23 0x000000010ee35af7 in patmatch ()
#24 0x000000010ee34325 in patcompile ()
#25 0x000000010ee7eedd in ?? ()
#26 0x000000010ee7e71f in ?? ()
#27 0x000000010ee035e6 in gmatchcmp ()
#28 0x000000010ee42171 in paramsubst ()
#29 0x000000010ee0da39 in casemodify ()
#30 0x000000010ee091ff in hend ()
#31 0x000000010ee03d4f in bracechardots ()
#32 0x000000010ee02d7e in scanner ()
#33 0x000000010ee43065 in paramsubst ()
#34 0x000000010ee0da39 in casemodify ()
#35 0x000000010ee091ff in hend ()
#36 0x000000010ee03d4f in bracechardots ()
#37 0x000000010ee02d7e in scanner ()
#38 0x000000010ee026a5 in qualisblk ()
#39 0x000000010ee2cf8a in zputenv ()
#40 0x000000010ee31312 in par_cond_triple ()
#41 0x000000010ede5062 in _mh_execute_header ()
#42 0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-09 23:42                                     ` Bart Schaefer
  2015-08-10  0:02                                       ` Mikael Magnusson
@ 2015-08-10  0:29                                       ` Bart Schaefer
  1 sibling, 0 replies; 41+ messages in thread
From: Bart Schaefer @ 2015-08-10  0:29 UTC (permalink / raw)
  To: zsh-workers

On Aug 9,  4:42pm, Bart Schaefer wrote:
}
} Nevertheless, it looks like glob.c needs to protect some places where
} it manipulates global state.

I couldn't really find anything definitive -- all the memory management
routines (halloc, zhalloc, zfree, etc.) already do signal queuing, so
we only get into trouble with e.g. stdio using the library malloc/free
directly.

The hunks in patcompile() below are paranoia because the static globals
patcode, patsize, et al. are being frobbed -- but even with this I get
worried that a signal trap that uses pattern matching called in the
midst of some other pattern matching operation could leave those in an
inconsistent state, because they're not saved/restored like globbing
state in zglob().

Similarly if you were in the middle of a pattern that wanted to set the
MATCH / MBEGIN / MEND / match / mbegin / mend parameters and then a
trap handler also did so, it sure looks to me as if the state of those
parameters becomes indeterminate.

Patch below follows on to 36022 but doesn't overlap with it in any way.


diff --git a/Src/glob.c b/Src/glob.c
index eff34a2..f82c3bd 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -216,22 +216,26 @@ static struct globdata curglobdata;
 
 #define save_globstate(N) \
   do { \
+    queue_signals(); \
     memcpy(&(N), &curglobdata, sizeof(struct globdata)); \
     (N).gd_pathpos = pathpos; \
     (N).gd_pathbuf = pathbuf; \
     (N).gd_glob_pre = glob_pre; \
     (N).gd_glob_suf = glob_suf; \
     pathbuf = NULL; \
+    unqueue_signals(); \
   } while (0)
 
 #define restore_globstate(N) \
   do { \
+    queue_signals(); \
     zfree(pathbuf, pathbufsz); \
     memcpy(&curglobdata, &(N), sizeof(struct globdata)); \
     pathpos = (N).gd_pathpos; \
     pathbuf = (N).gd_pathbuf; \
     glob_pre = (N).gd_glob_pre; \
     glob_suf = (N).gd_glob_suf; \
+    unqueue_signals(); \
   } while (0)
 
 /* pathname component in filename patterns */
diff --git a/Src/pattern.c b/Src/pattern.c
index 8fa1a72..7d38988 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -520,6 +520,8 @@ patcompile(char *exp, int inflags, char **endexp)
     char *lng, *strp = NULL;
     Patprog p;
 
+    queue_signals();
+
     startoff = sizeof(struct patprog);
     /* Ensure alignment of start of program string */
     startoff = (startoff + sizeof(union upat) - 1) & ~(sizeof(union upat) - 1);
@@ -582,8 +584,10 @@ patcompile(char *exp, int inflags, char **endexp)
 	if (!strp || (*strp && *strp != '/')) {
 	    /* No, do normal compilation. */
 	    strp = NULL;
-	    if (patcompswitch(0, &flags) == 0)
+	    if (patcompswitch(0, &flags) == 0) {
+		unqueue_signals();
 		return NULL;
+	    }
 	} else {
 	    /*
 	     * Yes, copy the string, and skip compilation altogether.
@@ -715,6 +719,8 @@ patcompile(char *exp, int inflags, char **endexp)
 
     if (endexp)
 	*endexp = patparse;
+
+    unqueue_signals();
     return p;
 }
 

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10  0:02                                       ` Mikael Magnusson
  2015-08-10  0:16                                         ` Mathias Fredriksson
@ 2015-08-10  0:36                                         ` Bart Schaefer
  1 sibling, 0 replies; 41+ messages in thread
From: Bart Schaefer @ 2015-08-10  0:36 UTC (permalink / raw)
  To: zsh workers

On Aug 10,  2:02am, Mikael Magnusson wrote:
}
} > Did you "make install" before running this?  If so, *don't* -- run the
} > binary straight out of the build tree.  If you "make install" the symbol
} > table gets stripped

} I don't think this is the case, there's a separate install-strip
} target for that. I've always done make install and ran gdb on the
} resulting install successfully.

Hrm.  Well, there's SOME reason why his backtraces only have the function
names (and sometimes only some of those) and none of the call arguments.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10  0:16                                         ` Mathias Fredriksson
@ 2015-08-10  1:47                                           ` Bart Schaefer
  2015-08-10  2:02                                             ` Mikael Magnusson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-10  1:47 UTC (permalink / raw)
  To: zsh-workers

On Aug 10,  3:16am, Mathias Fredriksson wrote:
}
} I'm thinking this might be correct, at least doing a "make clean &&
} make" and running from Src/zsh did not give any more meaningful
} output:

On what platform are you building this, and is there anything in your
environment that might be causing optimization flags to be passed to
your C compiler?

Because this looks like optimized stack traces, and configuring with
--enable-zsh-debug is supposed to disable optimization, so if that's
not working we may need to update config.ac.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10  1:47                                           ` Bart Schaefer
@ 2015-08-10  2:02                                             ` Mikael Magnusson
  2015-08-10 15:59                                               ` Bart Schaefer
  0 siblings, 1 reply; 41+ messages in thread
From: Mikael Magnusson @ 2015-08-10  2:02 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh workers

On Mon, Aug 10, 2015 at 3:47 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Aug 10,  3:16am, Mathias Fredriksson wrote:
> }
> } I'm thinking this might be correct, at least doing a "make clean &&
> } make" and running from Src/zsh did not give any more meaningful
> } output:
>
> On what platform are you building this, and is there anything in your
> environment that might be causing optimization flags to be passed to
> your C compiler?
>
> Because this looks like optimized stack traces, and configuring with
> --enable-zsh-debug is supposed to disable optimization, so if that's
> not working we may need to update config.ac.

I think --enable-zsh-debug only sets the DEBUG define, and nothing
more. If you want to debug you should put appropriate things in CFLAGS
before running configure depending on your compiler. I use

-march=native -pipe -gdwarf-4 -fvar-tracking-assignments -g3 -Og

-Og needs relatively recent gcc, if you don't have it, use -O0 or -O1 instead.

-- 
Mikael Magnusson


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10  2:02                                             ` Mikael Magnusson
@ 2015-08-10 15:59                                               ` Bart Schaefer
  2015-08-10 17:30                                                 ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-10 15:59 UTC (permalink / raw)
  To: zsh workers

On Aug 10,  4:02am, Mikael Magnusson wrote:
} Subject: Re: Deadlock when receiving kill-signal from child process
}
} I think --enable-zsh-debug only sets the DEBUG define, and nothing
} more.

My generated configure script contains:

if test -n "$auto_cflags" && test ."$ansi2knr" != .yes; then
  if test "${enable_zsh_debug}" = yes; then
    if test -n "$GCC"; then
      CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -ggdb"
    else
      CFLAGS="$CFLAGS -g"
    fi
  else
    if test -n "$GCC"; then
      CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -O2"
    else
      CFLAGS="$CFLAGS -O"
    fi
  fi
fi

So apparently on Mathias's platform, passing -g plus not passing -O is
not sufficient to actually enable debugging symbols.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10 15:59                                               ` Bart Schaefer
@ 2015-08-10 17:30                                                 ` Mathias Fredriksson
  0 siblings, 0 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-10 17:30 UTC (permalink / raw)
  To: zsh-workers

On Mon, Aug 10, 2015 at 6:59 PM, Bart Schaefer wrote:
}
} So apparently on Mathias's platform, passing -g plus not passing -O is
} not sufficient to actually enable debugging symbols.

For me "-Wall -Wmissing-prototypes -ggdb" are selected as CFLAGS by
configure. I have tried to play around with the optimization flag
(-O), but I'm seeing weird results.

With -O0 I get the same kind of output as before

With -O1 and -O2:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e1635 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x0000000103e15f6d in parsecmd ()
#6  0x0000000103e199a3 in execcmd ()
#7  0x0000000103e148db in execpline ()
#8  0x0000000103e13cfe in execlist ()
#9  0x0000000103e13b02 in execlist ()
#10 0x0000000103e17d3c in execcmd ()
#11 0x0000000103e1767e in execrestore ()
#12 0x0000000103e6037d in paramsubst ()
#13 0x0000000103e5f5e8 in paramsubst ()
#14 <signal handler called>
Cannot access memory at address 0x90

With just -O:

#0  0x00007fff8abf95da in syscall_thread_switch ()
#1  0x00007fff853a982d in _OSSpinLockLockSlow ()
#2  0x00007fff896e1635 in szone_force_lock ()
#3  0x00007fff896e15e6 in _malloc_fork_prepare ()
#4  0x00007fff82cb8097 in fork ()
#5  0x0000000104edac5a in doshfunc ()
#6  0x0000000104eded31 in execcmd ()
#7  0x0000000104ed94f4 in getoutput ()
#8  0x0000000104ed88db in execpline ()
#9  0x0000000104ed86d2 in execpline ()
#10 0x0000000104edcbf4 in execcmd ()
#11 0x0000000104edc54c in execcmd ()
#12 0x0000000104f34ba2 in dowatch ()
#13 0x0000000104f33c27 in lchdir ()
#14 0x0000000104f3349c in addunprintable ()
#15 <signal handler called>
Cannot access memory at address 0x90


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-09 13:53                                   ` Mathias Fredriksson
  2015-08-09 23:42                                     ` Bart Schaefer
@ 2015-08-10 19:34                                     ` Bart Schaefer
  2015-08-10 21:17                                       ` Mathias Fredriksson
  1 sibling, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-10 19:34 UTC (permalink / raw)
  To: zsh-workers

On Aug 9,  4:53pm, Mathias Fredriksson wrote:
}
} At first I thought there were absolutely no more deadlocks, but I
} managed to repeatedly produce one (when _not_ disowning the child
} processes).

Reviewing the code again has led me to realize / recall that although
we consistently use our signal-safe wrappers around malloc(), the
similar wrapper around free() is enabled only when the configuration
has included --enable-zsh-mem.  Further, we're inconsistent about using
the signal-safe wrapper for realloc() [a better one gets compiled in
with --enable-zsh-mem].  The last few stack traces you've sent [except
for the most recent one mentioning fork()] indicate clashes between
realloc() and free(), even though other parts of the stack look wonky.

Even with --enable-zsh-mem the realloc() wrapper sometimes calls
malloc() unsafely, though that wouldn't be hard to fix.

A quick grep indicates 34 realloc() and 224 free() scattered around
the code.  Probably many of them are already within queue_signals().
The patch below fixes four of them that your stack traces seem to
point to as particular culprits.  It's probably not worth it to try
to pre-emptively change all the others.

If you are still able to create deadlocks after the below, I'd also
ask you to try configuring with --enable-zsh-mem and see if that gets
rid of any remaining deadlocks.

It'd also be interesting to benchmark a few versions of zsh including
the latest from git, on things like how long **/* takes in a big tree,
how long "make check" takes to run, etc., both with and without using
--enable-zsh-mem.  Any volunteers?


diff --git a/Src/glob.c b/Src/glob.c
index f82c3bd..3af4690 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -257,7 +257,7 @@ addpath(char *s, int l)
 {
     DPUTS(!pathbuf, "BUG: pathbuf not initialised");
     while (pathpos + l + 1 >= pathbufsz)
-	pathbuf = realloc(pathbuf, pathbufsz *= 2);
+	pathbuf = zrealloc(pathbuf, pathbufsz *= 2);
     while (l--)
 	pathbuf[pathpos++] = *s++;
     pathbuf[pathpos++] = '/';
diff --git a/Src/text.c b/Src/text.c
index cf73004..3978a26 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -77,7 +77,7 @@ taddpending(char *str1, char *str2)
      */
     if (tpending) {
 	int oldlen = strlen(tpending);
-	tpending = realloc(tpending, len + oldlen);
+	tpending = zrealloc(tpending, len + oldlen);
 	sprintf(tpending + oldlen, "%s%s", str1, str2);
     } else {
 	tpending = (char *)zalloc(len);
@@ -110,7 +110,7 @@ taddchr(int c)
 	    tptr--;
 	    return;
 	}
-	tbuf = realloc(tbuf, tsiz *= 2);
+	tbuf = zrealloc(tbuf, tsiz *= 2);
 	tlim = tbuf + tsiz;
 	tptr = tbuf + tsiz / 2;
     }
@@ -130,7 +130,7 @@ taddstr(char *s)
 
 	if (!tbuf)
 	    return;
-	tbuf = realloc(tbuf, tsiz *= 2);
+	tbuf = zrealloc(tbuf, tsiz *= 2);
 	tlim = tbuf + tsiz;
 	tptr = tbuf + x;
     }

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10 19:34                                     ` Bart Schaefer
@ 2015-08-10 21:17                                       ` Mathias Fredriksson
  2015-08-10 22:53                                         ` Mathias Fredriksson
  0 siblings, 1 reply; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-10 21:17 UTC (permalink / raw)
  To: zsh-workers

On Mon, Aug 10, 2015 at 10:34 PM, Bart Schaefer wrote:
}
} A quick grep indicates 34 realloc() and 224 free() scattered around
} the code.  Probably many of them are already within queue_signals().
} The patch below fixes four of them that your stack traces seem to
} point to as particular culprits.  It's probably not worth it to try
} to pre-emptively change all the others.

That sounds reasonable to me.

}
} If you are still able to create deadlocks after the below, I'd also
} ask you to try configuring with --enable-zsh-mem and see if that gets
} rid of any remaining deadlocks.

I had one skill, Bart, to produce deadlocks. And now you've taken that
away from me! On a more serious note, I have not been able to produce
any deadlocks after 36084! I also did not get around to test with
--enable-zsh-mem since it is working just fine. I also tested building
zsh without debugging, no problems there either.

Thanks for sticking through with this, and good job on finding
(hopefully) all the edge cases :)!


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10 21:17                                       ` Mathias Fredriksson
@ 2015-08-10 22:53                                         ` Mathias Fredriksson
  2015-08-11  0:53                                           ` Bart Schaefer
  2015-08-11  4:06                                           ` Running commands in a zpty worker Bart Schaefer
  0 siblings, 2 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-10 22:53 UTC (permalink / raw)
  To: zsh-workers

On Tue, Aug 11, 2015 at 12:17 AM, Mathias Fredriksson wrote:
} ... On a more serious note, I have not been able to produce
} any deadlocks after 36084! I also did not get around to test with
} --enable-zsh-mem since it is working just fine. I also tested building
} zsh without debugging, no problems there either.

Well, scratch that. I went back to my original use case where I'm
running commands in a zpty worker and notifying the original zsh pid
that the work is done (previously through WINCH, now tested with
USR1). There are usually two of these commands that are started at
precmd and usually finish either before or shortly after the prompt is
rendered. Now if I hold enter at and empty prompt, I can reproduce
this deadlock very quickly.

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x00000001065013e9 in signal_suspend ()
#2  0x00000001064d8035 in zwaitjob ()
#3  0x00000001064d7e80 in waitjobs ()
#4  0x00000001064b9388 in execpline ()
#5  0x00000001064b86fb in execlist ()
#6  0x00000001064df9fc in execif ()
#7  0x00000001064bf4ce in execcmd ()
#8  0x00000001064b8fdd in execpline ()
#9  0x00000001064b8440 in execlist ()
#10 0x00000001064df9fc in execif ()
#11 0x00000001064bf4ce in execcmd ()
#12 0x00000001064b8fdd in execpline ()
#13 0x00000001064b8440 in execlist ()
#14 0x00000001064b8266 in execode ()
#15 0x00000001064bc092 in runshfunc ()
#16 0x00000001064bbabf in doshfunc ()
#17 0x00000001064c1fc1 in execshfunc ()
#18 0x00000001064bfc2b in execcmd ()
#19 0x00000001064b8fdd in execpline ()
#20 0x00000001064b8440 in execlist ()
#21 0x00000001064b8266 in execode ()
#22 0x00000001064bc092 in runshfunc ()
#23 0x00000001064bbabf in doshfunc ()
#24 0x000000010650ff96 in callhookfunc ()
#25 0x000000010651020f in preprompt ()
#26 0x00000001064d203e in loop ()
#27 0x00000001064d501b in zsh_main ()
#28 0x00007fff8610c5c9 in start ()

If I try to compile with --enable-zsh-mem I'm flooded with a bunch of
these messages (until zsh eventually segfaults):

3: mem.c:1575: MEM: allocation error at brk.
138: mem.c:1514: BUG: attempt to free storage at invalid address
175: mem.c:1514: BUG: attempt to free storage at invalid address
...
8: mem.c:1514: BUG: attempt to free storage at invalid address
8: mem.c:1514: BUG: attempt to free storage at invalid address
12: mem.c:1281: MEM: allocation error at sbrk, size 20480.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-10 22:53                                         ` Mathias Fredriksson
@ 2015-08-11  0:53                                           ` Bart Schaefer
  2015-08-11 12:17                                             ` Mathias Fredriksson
  2015-08-11  4:06                                           ` Running commands in a zpty worker Bart Schaefer
  1 sibling, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-11  0:53 UTC (permalink / raw)
  To: zsh-workers

On Aug 11,  1:53am, Mathias Fredriksson wrote:
}
} Well, scratch that. I went back to my original use case where I'm
} running commands in a zpty worker and notifying the original zsh pid
} that the work is done (previously through WINCH, now tested with
} USR1). There are usually two of these commands that are started at
} precmd and usually finish either before or shortly after the prompt is
} rendered. Now if I hold enter at and empty prompt, I can reproduce
} this deadlock very quickly.

Interesting.  I deliberately excluded preprompt() from the signal queue
in my init.c:loop() edit.  Try this:


diff --git a/Src/init.c b/Src/init.c
index f2021f0..22db4b3 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -127,9 +127,7 @@ loop(int toplevel, int justonce)
 		 * no matter what.
 		 */
 		errflag = 0;
-		unqueue_signals();
 		preprompt();
-		queue_signals();
 		if (stophist != 3)
 		    hbegin(1);
 		else


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

* Running commands in a zpty worker
  2015-08-10 22:53                                         ` Mathias Fredriksson
  2015-08-11  0:53                                           ` Bart Schaefer
@ 2015-08-11  4:06                                           ` Bart Schaefer
  2015-08-11 13:14                                             ` Mathias Fredriksson
  1 sibling, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-11  4:06 UTC (permalink / raw)
  To: zsh-workers

On Aug 11,  1:53am, Mathias Fredriksson wrote:
}
} I went back to my original use case where I'm running commands in a
} zpty worker and notifying the original zsh pid that the work is done
} (previously through WINCH, now tested with USR1).

Incidentally you might try using ZLE handler functions for this instead
of signals.  You'd need a FIFO for the zpty command to write to and the
ZLE handler to listen on.

Which is really kind of silly given that there's already a descriptor.
With this patch you can do e.g.

  typeset -A ptys
  watcher() { local line; zpty -r $ptys[$1] line; etc with $line }
  zpty firstPTY some command ...
  ptys[$REPLY]=firstPTY
  zle -F $REPLY watcher

Just be careful to remove the handler before the slave side of the pty
is closed (e.g., worker exits) or you may end up with a runaway handler.


diff --git a/Doc/Zsh/mod_zpty.yo b/Doc/Zsh/mod_zpty.yo
index 340f983..44b375a 100644
--- a/Doc/Zsh/mod_zpty.yo
+++ b/Doc/Zsh/mod_zpty.yo
@@ -18,6 +18,15 @@ characters are echoed.
 
 With the tt(-b) option, input to and output from the pseudo-terminal are
 made non-blocking.
+
+The shell parameter tt(REPLY) is set to the file descriptor assigned to
+the master side of the pseudo-terminal.  This allows the terminal to be
+monitored with ZLE descriptor handlers (see ifzman(zmanref(zshzle))\
+ifnzman(noderef(Zle Builtins))) or manipulated with tt(sysread) and
+tt(syswrite) (see ifzman(THE ZSH/SYSTEM MODULE in zmanref(zshmodules))\
+ifnzman(noderef(The zsh/system Module))).  em(Warning): Use of tt(sysread)
+and tt(syswrite) is em(not) recommended, use tt(zpty -r) and tt(zpty -w)
+unless you know exactly what you are doing.
 )
 item(tt(zpty) tt(-d) [ var(name) ... ])(
 The second form, with the tt(-d) option, is used to delete commands
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 7b6130c..12e42b5 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -463,6 +463,8 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 #endif
 	    errno == EINTR));
 
+    setiparam("REPLY", master);
+
     return 0;
 }
 


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-11  0:53                                           ` Bart Schaefer
@ 2015-08-11 12:17                                             ` Mathias Fredriksson
  2015-08-11 14:38                                               ` Mathias Fredriksson
  2015-08-11 15:07                                               ` Bart Schaefer
  0 siblings, 2 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-11 12:17 UTC (permalink / raw)
  To: zsh-workers

On Tue, Aug 11, 2015 at 3:53 AM, Bart Schaefer wrote:
> On Aug 11,  1:53am, Mathias Fredriksson wrote:
>
> Interesting.  I deliberately excluded preprompt() from the signal queue
> in my init.c:loop() edit.  Try this:

Ah, that would explain why it happened again. Unfortunately, that
patch seems insufficient:

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x00000001013bc3e9 in signal_suspend ()
#2  0x0000000101392fc1 in zwaitjob ()
#3  0x0000000101392e0c in waitjobs ()
#4  0x0000000101374314 in execpline ()
#5  0x0000000101373687 in execlist ()
#6  0x000000010139a988 in execif ()
#7  0x000000010137a45a in execcmd ()
#8  0x0000000101373f69 in execpline ()
#9  0x00000001013733cc in execlist ()
#10 0x000000010139a988 in execif ()
#11 0x000000010137a45a in execcmd ()
#12 0x0000000101373f69 in execpline ()
#13 0x00000001013733cc in execlist ()
#14 0x00000001013731f2 in execode ()
#15 0x000000010137701e in runshfunc ()
#16 0x0000000101376a4b in doshfunc ()
#17 0x000000010137cf4d in execshfunc ()
#18 0x000000010137abb7 in execcmd ()
#19 0x0000000101373f69 in execpline ()
#20 0x00000001013733cc in execlist ()
#21 0x00000001013731f2 in execode ()
#22 0x000000010137701e in runshfunc ()
#23 0x0000000101376a4b in doshfunc ()
#24 0x00000001013caf96 in callhookfunc ()
#25 0x00000001013cb20f in preprompt ()
#26 0x000000010138cfca in loop ()
#27 0x000000010138ffa7 in zsh_main ()
#28 0x00007fff8610c5c9 in start ()


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

* Re: Running commands in a zpty worker
  2015-08-11  4:06                                           ` Running commands in a zpty worker Bart Schaefer
@ 2015-08-11 13:14                                             ` Mathias Fredriksson
  2015-08-11 14:35                                               ` Mathias Fredriksson
  2015-08-11 14:37                                               ` Bart Schaefer
  0 siblings, 2 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-11 13:14 UTC (permalink / raw)
  To: zsh-workers

On Tue, Aug 11, 2015 at 7:06 AM, Bart Schaefer wrote:
>
> Incidentally you might try using ZLE handler functions for this instead
> of signals.  You'd need a FIFO for the zpty command to write to and the
> ZLE handler to listen on.

Oh, that is really cool! Thanks for the patch, it works great.

> Just be careful to remove the handler before the slave side of the pty
> is closed (e.g., worker exits) or you may end up with a runaway handler.

Any tips on how I should go about doing this, can it be done with zle -D?


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

* Re: Running commands in a zpty worker
  2015-08-11 13:14                                             ` Mathias Fredriksson
@ 2015-08-11 14:35                                               ` Mathias Fredriksson
  2015-08-11 14:37                                               ` Bart Schaefer
  1 sibling, 0 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-11 14:35 UTC (permalink / raw)
  To: zsh-workers

On Tue, Aug 11, 2015 at 4:14 PM, Mathias Fredriksson wrote:
>
> Any tips on how I should go about doing this, can it be done with zle -D?

Ok, so a closer look at the documentation revealed that I can just do
this with zle -F $REPLY. Since not passing a handler removes any that
are present. Thanks again, it's precisely what I originally was
looking for.


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

* Re: Running commands in a zpty worker
  2015-08-11 13:14                                             ` Mathias Fredriksson
  2015-08-11 14:35                                               ` Mathias Fredriksson
@ 2015-08-11 14:37                                               ` Bart Schaefer
  1 sibling, 0 replies; 41+ messages in thread
From: Bart Schaefer @ 2015-08-11 14:37 UTC (permalink / raw)
  To: zsh-workers

On Aug 11,  4:14pm, Mathias Fredriksson wrote:
}
} > Just be careful to remove the handler before the slave side of the pty
} > is closed (e.g., worker exits) or you may end up with a runaway handler.
} 
} Any tips on how I should go about doing this, can it be done with zle -D?

The doc:
          If no HANDLER is given, but an FD is present, any handler for
          that FD is removed.  If there is none, an error message is
          printed and status 1 is returned.

You can even do this from inside the handler function itself with

    zle -F $1

assuming that the handler has detected that the FD is no longer useful.


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-11 12:17                                             ` Mathias Fredriksson
@ 2015-08-11 14:38                                               ` Mathias Fredriksson
  2015-08-11 15:07                                               ` Bart Schaefer
  1 sibling, 0 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-11 14:38 UTC (permalink / raw)
  To: zsh-workers

On Tue, Aug 11, 2015 at 3:17 PM, Mathias Fredriksson wrote:
> Ah, that would explain why it happened again. Unfortunately, that
> patch seems insufficient:

Actually I had unsuccessfully applied the last patch here, really
sorry about that! Doesn't change the fact that it still freezes
(pretty identically) though:

#0  0x00007fff8abfe72a in __sigsuspend ()
#1  0x000000010284a429 in signal_suspend ()
#2  0x0000000102821001 in zwaitjob ()
#3  0x0000000102820e4c in waitjobs ()
#4  0x000000010280240c in execpline ()
#5  0x000000010280177f in execlist ()
#6  0x00000001028289c8 in execif ()
#7  0x0000000102808552 in execcmd ()
#8  0x0000000102802061 in execpline ()
#9  0x00000001028014c4 in execlist ()
#10 0x00000001028289c8 in execif ()
#11 0x0000000102808552 in execcmd ()
#12 0x0000000102802061 in execpline ()
#13 0x00000001028014c4 in execlist ()
#14 0x00000001028012ea in execode ()
#15 0x0000000102805116 in runshfunc ()
#16 0x0000000102804b43 in doshfunc ()
#17 0x000000010280b045 in execshfunc ()
#18 0x0000000102808caf in execcmd ()
#19 0x0000000102802061 in execpline ()
#20 0x00000001028014c4 in execlist ()
#21 0x00000001028012ea in execode ()
#22 0x0000000102805116 in runshfunc ()
#23 0x0000000102804b43 in doshfunc ()
#24 0x0000000102858fd6 in callhookfunc ()
#25 0x000000010285924f in preprompt ()
#26 0x000000010281b02e in loop ()
#27 0x000000010281dfe7 in zsh_main ()
#28 0x00007fff8610c5c9 in start ()


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-11 12:17                                             ` Mathias Fredriksson
  2015-08-11 14:38                                               ` Mathias Fredriksson
@ 2015-08-11 15:07                                               ` Bart Schaefer
  2015-08-11 15:22                                                 ` Mathias Fredriksson
  1 sibling, 1 reply; 41+ messages in thread
From: Bart Schaefer @ 2015-08-11 15:07 UTC (permalink / raw)
  To: zsh-workers

On Aug 11,  3:17pm, Mathias Fredriksson wrote:
}
} #0  0x00007fff8abfe72a in __sigsuspend ()
} #1  0x00000001013bc3e9 in signal_suspend ()
} #2  0x0000000101392fc1 in zwaitjob ()
} #3  0x0000000101392e0c in waitjobs ()
} #4  0x0000000101374314 in execpline ()

This looks like we're waiting for a non-existent job again.  Last time
it was the strace output that pointed to the culprit, because here the
call stack has most likely grown and shrunk several times before the
blocking waitjobs() is finally called.

execpline() already does queue_signals() around its only waitjobs(),
and zwaitjob() runs the signal queue before checking the status of
jobs, so the following is a bit of a shot in the dark, rearranging
the order in which SIGCHILD and the queues are managed.  I think it's
probably better to do it in this order anyway, I was undecided about
it when I initially made the patches.


diff --git a/Src/exec.c b/Src/exec.c
index a635c18..45f1c66 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1607,8 +1607,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 		    !(jobtab[list_pipe_job].stat & STAT_STOPPED)) {
 		    int q = queue_signal_level();
 		    child_unblock();
-		    dont_queue_signals();
 		    child_block();
+		    dont_queue_signals();
 		    restore_queue_signals(q);
 		}
 		if (list_pipe_child &&
diff --git a/Src/jobs.c b/Src/jobs.c
index 9333488..ed647b8 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1420,9 +1420,9 @@ zwaitjob(int job, int wait_cmd)
     int q = queue_signal_level();
     Job jn = jobtab + job;
 
-    dont_queue_signals();
     child_block();		 /* unblocked during signal_suspend() */
     queue_traps(wait_cmd);
+    dont_queue_signals();
     if (jn->procs || jn->auxprocs) { /* if any forks were done         */
 	jn->stat |= STAT_LOCKED;
 	if (jn->stat & STAT_CHANGED)
@@ -1478,9 +1478,9 @@ zwaitjob(int job, int wait_cmd)
 	pipestats[0] = lastval;
 	numpipestats = 1;
     }
+    restore_queue_signals(q);
     unqueue_traps();
     child_unblock();
-    restore_queue_signals(q);
 
     return 0;
 }

-- 
Barton E. Schaefer


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

* Re: Deadlock when receiving kill-signal from child process
  2015-08-11 15:07                                               ` Bart Schaefer
@ 2015-08-11 15:22                                                 ` Mathias Fredriksson
  0 siblings, 0 replies; 41+ messages in thread
From: Mathias Fredriksson @ 2015-08-11 15:22 UTC (permalink / raw)
  To: zsh-workers

On Tue, Aug 11, 2015 at 6:07 PM, Bart Schaefer wrote:
>
> This looks like we're waiting for a non-existent job again.  Last time
> it was the strace output that pointed to the culprit, because here the
> call stack has most likely grown and shrunk several times before the
> blocking waitjobs() is finally called.
>
> execpline() already does queue_signals() around its only waitjobs(),
> and zwaitjob() runs the signal queue before checking the status of
> jobs, so the following is a bit of a shot in the dark, rearranging
> the order in which SIGCHILD and the queues are managed.  I think it's
> probably better to do it in this order anyway, I was undecided about
> it when I initially made the patches.

That seems to have done it, can't reproduce anymore!


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

end of thread, other threads:[~2015-08-11 15:23 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 11:25 Deadlock when receiving kill-signal from child process Mathias Fredriksson
2015-08-03 15:52 ` Bart Schaefer
2015-08-03 20:36   ` Mathias Fredriksson
2015-08-03 20:58     ` Bart Schaefer
2015-08-04 21:52       ` Mathias Fredriksson
2015-08-05  0:05         ` Mathias Fredriksson
2015-08-05  6:53         ` Bart Schaefer
2015-08-05 10:37           ` Mathias Fredriksson
2015-08-05 15:52             ` Bart Schaefer
2015-08-05 16:05               ` Mathias Fredriksson
2015-08-05 18:52                 ` Bart Schaefer
2015-08-05 19:11                   ` Mathias Fredriksson
2015-08-05 20:20                     ` Bart Schaefer
2015-08-05 21:49                       ` Mathias Fredriksson
2015-08-06  5:06                         ` Bart Schaefer
2015-08-06  8:24                           ` Mathias Fredriksson
2015-08-06 15:54                             ` Bart Schaefer
2015-08-07  0:45                               ` Mathias Fredriksson
2015-08-07  5:39                                 ` Bart Schaefer
2015-08-09 13:53                                   ` Mathias Fredriksson
2015-08-09 23:42                                     ` Bart Schaefer
2015-08-10  0:02                                       ` Mikael Magnusson
2015-08-10  0:16                                         ` Mathias Fredriksson
2015-08-10  1:47                                           ` Bart Schaefer
2015-08-10  2:02                                             ` Mikael Magnusson
2015-08-10 15:59                                               ` Bart Schaefer
2015-08-10 17:30                                                 ` Mathias Fredriksson
2015-08-10  0:36                                         ` Bart Schaefer
2015-08-10  0:29                                       ` Bart Schaefer
2015-08-10 19:34                                     ` Bart Schaefer
2015-08-10 21:17                                       ` Mathias Fredriksson
2015-08-10 22:53                                         ` Mathias Fredriksson
2015-08-11  0:53                                           ` Bart Schaefer
2015-08-11 12:17                                             ` Mathias Fredriksson
2015-08-11 14:38                                               ` Mathias Fredriksson
2015-08-11 15:07                                               ` Bart Schaefer
2015-08-11 15:22                                                 ` Mathias Fredriksson
2015-08-11  4:06                                           ` Running commands in a zpty worker Bart Schaefer
2015-08-11 13:14                                             ` Mathias Fredriksson
2015-08-11 14:35                                               ` Mathias Fredriksson
2015-08-11 14:37                                               ` Bart Schaefer

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).