Pablo Galindo Salgado <pablog...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33613>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to