Author christian.heimes
Recipients christian.heimes, hynek, tarek, vstinner
Date 2013-08-16.15:21:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376666498.06.0.618743202178.issue18756@psf.upfronthosting.co.za>
In-reply-to
Content
I have seen complains from e.g. Tarek that os.urandom() fails under high load: https://twitter.com/tarek_ziade/status/362281268215418880

The problem is caused by file descriptor limits. os.urandom() opens /dev/urandom for every call. How about os.urandom() uses a persistent file descriptor? That should eliminate the error. It may alsos speed up os.urandom() because a persistent FD gets rid of open() and close() syscalls.

* open /dev/urandom on first call of os.urandom() and store the fd in a static var
* invalidate, close fd on read() -> EINVAL; open /dev/urandom again
* close fd when interpreter shuts down
History
Date User Action Args
2013-08-16 15:21:38christian.heimessetrecipients: + christian.heimes, vstinner, tarek, hynek
2013-08-16 15:21:38christian.heimessetmessageid: <1376666498.06.0.618743202178.issue18756@psf.upfronthosting.co.za>
2013-08-16 15:21:38christian.heimeslinkissue18756 messages
2013-08-16 15:21:37christian.heimescreate