This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients koobs, pablogsal, pitrou, serhiy.storchaka, skrah, vstinner
Date 2017-10-30.23:50:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509407414.42.0.213398074469.issue31629@psf.upfronthosting.co.za>
In-reply-to
Content
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} ---
History
Date User Action Args
2017-10-30 23:50:14pablogsalsetrecipients: + pablogsal, pitrou, vstinner, skrah, serhiy.storchaka, koobs
2017-10-30 23:50:14pablogsalsetmessageid: <1509407414.42.0.213398074469.issue31629@psf.upfronthosting.co.za>
2017-10-30 23:50:14pablogsallinkissue31629 messages
2017-10-30 23:50:14pablogsalcreate