Author pablogsal
Recipients davin, pablogsal, pitrou, serhiy.storchaka, vstinner
Date 2018-06-20.21:00:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1529528430.48.0.56676864532.issue33613@psf.upfronthosting.co.za>
In-reply-to
Content
There are two problems in test_semaphore_tracker_sigint. One of the problems is that if `should_die` is False, the code does not check
that no warning is raised (and the warning is being raised, so this
the error has pass silently.) The other problem is a race condition
between the parent calls `_semaphore_tracker.ensure_running()` (which in turn spawns the semaphore_tracker using `_posixsubprocess.fork_exec`) and the child registering the signals. So basically, the parent sends the signal before the child protects against the signal. Modifying:

        _semaphore_tracker.ensure_running()
        pid = _semaphore_tracker._pid
        os.kill(pid, signum)
        time.sleep(1.0)  # give it time to die

to

        _semaphore_tracker.ensure_running()
        pid = _semaphore_tracker._pid
        time.sleep(1.0) # Give time for the child to register the signal handlers
        os.kill(pid, signum)
        time.sleep(1.0)  # give it time to die

fix the issue. I have tested this on one of the most grumpy and slow buildbots (gcc110) and it works.

I cannot think of a different way of waiting for the child to register the signals without modifying the child code for testing so I am not sure that we can do anything rather than the sleep.
History
Date User Action Args
2018-06-20 21:00:30pablogsalsetrecipients: + pablogsal, pitrou, vstinner, serhiy.storchaka, davin
2018-06-20 21:00:30pablogsalsetmessageid: <1529528430.48.0.56676864532.issue33613@psf.upfronthosting.co.za>
2018-06-20 21:00:30pablogsallinkissue33613 messages
2018-06-20 21:00:30pablogsalcreate