interrupted system call w/ Queue.get

Jean-Paul Calderone calderone.jeanpaul at gmail.com
Fri Feb 18 15:23:06 CET 2011


On Feb 17, 8:46 pm, Philip Winston <pwins... at gmail.com> wrote:
> We have a multiprocess Python program that uses Queue to communicate
> between processes.  Recently we've seen some errors while blocked
> waiting on Queue.get:
>
> IOError: [Errno 4] Interrupted system call
>
> What causes the exception?  Is it necessary to catch this exception
> and manually retry the Queue operation?  Thanks.
>

The exception is caused by a syscall returning EINTR.  A syscall will
return EINTR when a signal arrives and interrupts whatever that
syscall
was trying to do.  Typically a signal won't interrupt the syscall
unless you've installed a signal handler for that signal.  However,
you can avoid the interruption by using `signal.siginterrupt` to
disable interruption on that signal after you've installed the
handler.

As for the other questions - I don't know, it depends how and why it
happens, and whether it prevents your application from working
properly.

Jean-Paul



More information about the Python-list mailing list