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

Deadlock when receiving kill-signal from child process



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: zsh_deadlock.out
Description: Binary data



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