cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=aae2e49744824d8698262fca943b5c47c94ee560
commit aae2e49744824d8698262fca943b5c47c94ee560 Author: Mike Blumenkrantz <zm...@samsung.com> Date: Thu Sep 19 14:03:59 2019 -0400 ecore/signal: also use nonblock for writing side of signal pipe if any efl-based process receives a bunch of signals in a short period of time, it will deadlock in the signal handler. this is unavoidable given the current signal handling architecture by setting nonblock, we can at least avoid deadlocking even if it means we'll be losing signal events @fix Reviewed-by: Cedric BAIL <cedric.b...@free.fr> Differential Revision: https://phab.enlightenment.org/D10025 --- src/lib/ecore/ecore_signal.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c index e16694b55a..c3e5b0fda9 100644 --- a/src/lib/ecore/ecore_signal.c +++ b/src/lib/ecore/ecore_signal.c @@ -168,13 +168,17 @@ _ecore_signal_callback(int sig, siginfo_t *si, void *foo EINA_UNUSED) { int err = errno; if (pipe_dead) return; - const ssize_t bytes = write(sig_pipe[1], &sdata, sizeof(sdata)); - if (EINA_UNLIKELY(bytes != sizeof(sdata))) + do { - err = errno; - ERR("write() failed: %s", strerror(err)); - } - errno = err; + const ssize_t bytes = write(sig_pipe[1], &sdata, sizeof(sdata)); + if (EINA_UNLIKELY(bytes != sizeof(sdata))) + { + err = errno; + ERR("write() failed: %d: %s", err, strerror(err)); + } + errno = err; + /* loop if we got preempted */ + } while (err == EINTR); } switch (sig) { @@ -249,6 +253,8 @@ _ecore_signal_pipe_init(void) eina_file_close_on_exec(sig_pipe[1], EINA_TRUE); if (fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK) < 0) ERR("can't set pipe to NONBLOCK"); + if (fcntl(sig_pipe[1], F_SETFL, O_NONBLOCK) < 0) + ERR("can't set pipe to NONBLOCK"); } _signalhandler_setup(); --