[issue31629] test_many_processes() of test_multiprocessing_fork fails randomly on FreeBSD

Pablo Galindo Salgado report at bugs.python.org
Mon Oct 30 19:50:14 EDT 2017


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

I have tracked the issue down to the call inside the call to initscr in _cursesmodule.c. The issue *seems* related to the fact that all processes are sharing the same initialization of the curses internal structures, that (probably) is also related to an error that happens when calling initscr multiple times. Notice that:

def sleep_some():
    curses.initscr()
    curses.endwin()
    time.sleep(100)

(without calling initscr in the parent)

yields the correct results:

-15 -15
-15 -15
-15 -15

while doing the same but interleaving one all to initscr after the first fork:

for p in procs:
    p.start()
    curses.initscr()

yields correct results for the first child but incorrect for the rest:

-15 -15
1 -15
1 -15

It seems that forking (because spawn or forkserver always works) after doing the call to initscr does something to the child that makes it unable to handle/receive SIGTERM. The exit statuses of this last round are:

[pid 27105] +++ killed by SIGTERM +++
[pid 27104] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=27105, si_uid=1000, si_status=SIGTERM, si_utime=0, si_stime=0} ---
[pid 27106] +++ exited with 1 +++
[pid 27104] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27106, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
[pid 27107] +++ exited with 1 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27107, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---

----------
nosy: +pablogsal

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31629>
_______________________________________


More information about the Python-bugs-list mailing list