Opened 8 years ago

Last modified 8 years ago

#2354 defect new

Handling of EINTR in threadedselectreactor.py

Reported by: dkosovic Owned by: dkosovic
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description

The select loop in twisted/internet/threadedselectreactor.py (or _threadedselect.py in SVN trunk) which handles EINTR returns immediately rather than retrying again with a continue statement e.g like the continue in the attached patch.

For me on Fedora Core 6 with wxPython, _doSelectInThread only occasionally does one successful iteration because of EINTR return statement.

Attachments (1)

twisted-EINTR.patch (485 bytes) - added by dkosovic 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by dkosovic

comment:1 Changed 8 years ago by exarkun

What do you mean "only occasionally does one successful iteration"? The reactor is going to end up in select again pretty soon after _doSelectInThread returns. Why does this need to be a continue instead of a return?

comment:2 Changed 8 years ago by dkosovic

The problem is with the AccessGrid toolkit has with the EINTR. The following is a comment from an AccessGrid developer in regards to the readedselectreactor.py patch in AccessGrid bug #1484:
http://bugzilla.mcs.anl.gov/accessgrid/show_bug.cgi?id=1484

The problem is that the event client gets interrupted by a
signal (SIGRT_1) and never continues. It never continues because
of the handling of the socket.error(EINTR) in the twisted
threadedselectreactor interleave loop. This patch addresses
that problem by allowing the loop to continue operating.

Ignore my comment "About only occasionally does one successful iteration". I thought the AccessGrid Toolkit worked correctly the first time it went through that code, but not on subsequent attempts, but I think I was mistaken.

comment:3 Changed 8 years ago by glyph

  • Owner changed from glyph to dkosovic

This patch needs tests.

Note: See TracTickets for help on using tickets.