On Sun, Oct 29, 2017 at 8:56 AM, Piet van Oostrum <pie...@vanoostrum.org> wrote: > I am using Python 2.7.14 on MacOS Sierra. > > I have a small Python program that calls a shell script in a loop with a > time.sleep() in it. > The shell script is called with subprocess.Popen(), followed by a > subprocess.wait(). > No information is exchanged with the shell script. > > Once in a while I send a SIGINT to the program to cancel the sleep. I don't > know if the sleep is active at the time of the SIGINT, but most of the time > it will be as it takes much more time than the shell script. > > I do this by having a handler for the SIGINT which does nothing. It is just > there to have the SIGINT silently cancel the sleep. > > Now after weeks of running correctly it crashed. It appears that the SIGINT > came during the Popen. This causes a system call in the Popen to be > terminated with EINTR and Popen then retries that system call, but > unfortunately it fails. It seems to me that this could be a bug.
That definitely could be a bug. The behaviour of signals and retries of system calls got changed more recently, but Python 2.7 is the oldstable version and didn't get that sort of change. My advice to you is simply live with it; the probability of it recurring is low (if, as you say, the sleep takes the bulk of the time), unless you can migrate to Python 3, to take advantage of the new behaviour. ChrisA -- https://mail.python.org/mailman/listinfo/python-list