[IronPython] Problem with random module in IPY 1.1.1

Dino Viehland dinov at microsoft.com
Mon Oct 13 23:29:42 CEST 2008


Wow, I'm surprised it's documented as being thread unsafe in CPython, but it's good to know.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ronnie Maor
Sent: Monday, October 13, 2008 1:57 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Problem with random module in IPY 1.1.1

problem was caused by calling random from several threads without locking.
it reproduces more easily in IPy than in CPython because of the GIL, but it's documented as not thread safe for CPython too.
On Sun, Oct 12, 2008 at 11:27 AM, Asaf Kleinbort <asaf at itstructures.com<mailto:asaf at itstructures.com>> wrote:

Hi,

We have encountered two strange errors in the 'random' module:

1.       At some point the random method 'getrandbits(63)' started (and kept) returning 0 - until we restarted the application.

2.       The random method 'shuffle' when applied on a list kept returning the same ordered list. Again - restarting the application solved the problem

An interesting remark is that issue #1 happened to us today in two different applications, around the same time.

Any ideas?

Thanks,

Asaf

_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081013/01eb954c/attachment.html>


More information about the Ironpython-users mailing list