Issue521701

classification
Title: list objects not thread-safe
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: fwierzbicki, itamar, pjenvey, ype, zyasoft
Priority: low Keywords:

Created on 2002-02-23.03:05:32 by itamar, last changed 2009-06-05.15:53:28 by zyasoft.

Files
File name Uploaded Description Edit Remove
threadsafety_test.py itamar, 2002-02-23.03:05:35 test case demonstrating the problem
Messages
msg580 (view) Author: Itamar Shtull-Trauring (itamar) Date: 2002-02-23.03:05:32
I expected, as in CPython, that built-in lists be
thread-safe, in that each operation (.append, .remove)
be atomic. This is not the case -- the attached script
is a test case. I've also seen java.lang.NullException
or some such error in my real code.
msg581 (view) Author: Ype (ype) Date: 2002-03-02.19:52:13
Logged In: YES 
user_id=125722

I don't think this is a bug in Jython.
The python docs specify nothing about thread safety of 
standard types and the threading module is explicitly 
recommended for inter thread communication.

CPython's central lock happens to enforce the thread
safety of it's implementation of standard types.

In Java the thread safety of standard types can be obtained
by using synchronized methods. In many JVM's synchronized
methods take more time to execute than non synchronized
ones, so this would slow down Jython.
Btw. the (internal) dictionaries used for namespaces are
thread safe in Jython.
msg4750 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-29.01:32:35
Jim, check it out, a 7 year old list thread safety test. It's very basic 
but we should incorporate it =]
msg4796 (view) Author: Jim Baker (zyasoft) Date: 2009-06-05.06:44:13
Sure, it's a good approach in terms of ensuring the structural integrity
of the list, and straightforward enough to add other methods with
similar guarantees.
msg4799 (view) Author: Jim Baker (zyasoft) Date: 2009-06-05.15:53:27
Added modified version of suggested thread safety test case in r6452.
History
Date User Action Args
2009-06-05 15:53:28zyasoftsetstatus: open -> closed
messages: + msg4799
2009-06-05 06:44:15zyasoftsetmessages: + msg4796
2009-05-29 01:32:35pjenveysetassignee: zyasoft
messages: + msg4750
nosy: + pjenvey, zyasoft
2008-11-01 02:49:35fwierzbickisetnosy: + fwierzbicki
2002-02-23 03:05:32itamarcreate