Issue1801802

classification
Title: JavaImportHelper not thread safe
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: otmarhumbel Nosy List: otmarhumbel
Priority: high Keywords:

Created on 2007-09-25.06:47:25 by otmarhumbel, last changed 2007-09-28.15:02:43 by otmarhumbel.

Files
File name Uploaded Description Edit Remove
javaimport_threadsafety.diff otmarhumbel, 2007-09-25.06:47:25 This diff against revision 3537 of trunk fixes the problem
Messages
msg1929 (view) Author: Oti Humbel (otmarhumbel) Date: 2007-09-25.06:47:25
In the addPackage() method, we currently do:

modules.__finditem__()
modules.__delitem__()
modules.__setitem__()

where modules = Py.getSystemState().modules.

Each of these methods for itself is synchronized, but not this sequence. So, under heavy load, java imports can fail with a KeyError in __delitem__().

Since __setitem__() directly does the job of replacing a null entry by a real package, there is no need to do __delitem__() first. And this would be perfectly thread safe.

A patch is attached (javaimport_threadsafety.diff)
msg1930 (view) Author: Oti Humbel (otmarhumbel) Date: 2007-09-28.15:02:43
fixed on trunk in r3543
merged to Release_2_2maint branch (using svnmerge.py) in r3544
History
Date User Action Args
2007-09-25 06:47:25otmarhumbelcreate