Message5748

Author akruis
Recipients akruis
Date 2010-04-26.09:58:42
SpamBayes Score 1.1265462e-08
Marked as misclassified No
Message-id <1272275922.99.0.452670390139.issue1602@psf.upfronthosting.co.za>
In-reply-to
Content
The current implementation of org.python.core.IdImpl is not fully thread save, because the #java_obj_id(Object) method is not synchronized. IdImpl uses a java.util.HashMap to store ID-values for objects. The API-doc for java.util.HashMap requires to synchronize concurrent access to HashMap.

IdImpl.java_obj_id(Object) method is indirectly called by thread.get_ident().
(thread.get_ident() -> org.python.core.Py.java_obj_id(Object) -> org.python.core.IdImpl.java_obj_id(Object)

Django uses thread.get_ident() in its transaction management code. I observed two deadlocks on a multiprocessor server, that were apparently caused by the IdImpl#isMap HashMap being corrupted. I can provide the Java thread dumps if anybody is interested.

The attached patch fixes this issue.
History
Date User Action Args
2010-04-26 09:58:42akruissetmessageid: <1272275922.99.0.452670390139.issue1602@psf.upfronthosting.co.za>
2010-04-26 09:58:42akruissetrecipients: + akruis
2010-04-26 09:58:42akruislinkissue1602 messages
2010-04-26 09:58:42akruiscreate