<div dir="ltr"><div>Hi everyone,</div><div><br></div><div>I am working on Tensorflow bindings and, at some point, Tensorflow forks a child process to invoke a separate program. Unfortunately, when running inside the Erlang VM, Tensorflow fails when calling waitpid, <a href="https://github.com/tensorflow/tensorflow/blob/7b637feb1d145d606a7b69481fd4943f3086d5a2/tensorflow/core/platform/default/subprocess.cc#L314-L323">in exactly this line</a>.<br></div><div><br></div><div>After some debugging, we found out the root cause is because the Erlang VM sets SIGCHLD to SIG_IGN. <a href="https://www.mkssoftware.com/docs/man3/waitpid.3.asp">According to waitpid docs</a>:</div><div><br></div><div>> If the calling process sets SIGCHLD to SIG_IGN, and the process has no unwaited for children that were transformed into zombie processes, the calling thread blocks until all of the children of the process terminate, at which time waitpid() returns -1 with errno set to ECHILD.</div><div><div><br></div><div>Setting os:set_signal(sigchld, default) fixes the issue, however, it leaves me wondering:</div><div><br></div><div>1. Is it safe to set sigchld back to default? Or is the VM expecting it to be ignored? Are there any implications we should be aware of?<br></div><div><br></div><div>2. In case it is safe to have it as a default, why is it being ignored in the first place?<br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><br></div><div>Thank you,<br></div><div><br></div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b><span style="border-collapse:separate;font-family:arial;font-weight:normal"><div><span><div><span style="font-size:13px"><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José Valim</b></span></div><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><div><span style="font-family:verdana,sans-serif;font-size:x-small"><a href="https://dashbit.co/" style="color:rgb(42,93,176)" target="_blank">https://dashbit.co/</a></span></div></span></div></span></div></span></div></span></b></span></div></div></div></div></div></div></div></div></div>