This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author benjamin.peterson
Recipients Joseph Sible, benjamin.peterson, miss-islington
Date 2018-09-12.23:33:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536795216.3905236.1506231144.3997AE95@webmail.messagingengine.com>
In-reply-to <1536793415.61.0.956365154283.issue34004@psf.upfronthosting.co.za>
Content
On Wed, Sep 12, 2018, at 16:03, Joseph Sible wrote:
> 2. Most of the time, counting on receiving an EINTR results in race 
> conditions. Our code seems to be affected by this too. Even on glibc, a 
> signal at just the "right" time could result in it not being 
> interrupted. This is why I think moving to an eventfd or something would 
> be better, since we could then use pselect/ppoll/etc. to avoid the 
> signal blocking race.

The race is a good point.

However, switching to eventfd is not trivial. It would be the third locking implementation in python just for pthreads. Using eventfd would require reimplementing all the userspace parts of locking (atomics, appropriate memory barriers, and spinning) ourselves. futex is carefully optimized for userspace locking, whereas I've never heard of normal program locking being done with eventfd before.

If the expected usecase for interrupting locks is user pressing C-c, being 99.99999% correct is probably enough.

So, it's fine with me if you open another issue for reimplementing locks with eventfd. But, I don't personally have the desire to do it.
History
Date User Action Args
2018-09-12 23:33:40benjamin.petersonsetrecipients: + benjamin.peterson, miss-islington, Joseph Sible
2018-09-12 23:33:39benjamin.petersonlinkissue34004 messages
2018-09-12 23:33:39benjamin.petersoncreate