Message12904

Author jeff.allen
Recipients FraOrolo, jeff.allen, zyasoft
Date 2019-12-26.16:54:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577379271.78.0.988149626729.issue2834@roundup.psfhosted.org>
In-reply-to
Content
There is a race in org.python.core.PyJavaPackage.addClass(String, Class<?>) where the __dict__ may be updated by threads that are importing into two different PySystemState. The distinct import locks do not stop them running at the same time, but here they are updating (in my example) the PyJavaPackage representing javax.swing.text, in order to add an entry for Utilities that will map to the PyJavaType that represents it.

This does not seem very serious, since both threads (Thread-1 and Thread-3 in my example) are inserting the same object. Of course, it's still wrong.

In the case where each PySystemState has its own class loader and the class in question (a user-defined one, I suppose) enters through a distinct class loader in each thread, these are different classes and will have distinct PyJavaType objects. Unless the (Java) package managers also segregate their hierarchies by loader, there seems a risk here of mixing entries in sys.modules. I'll see if I can make that happen.
History
Date User Action Args
2019-12-26 16:54:31jeff.allensetmessageid: <1577379271.78.0.988149626729.issue2834@roundup.psfhosted.org>
2019-12-26 16:54:31jeff.allensetrecipients: + jeff.allen, zyasoft, FraOrolo
2019-12-26 16:54:31jeff.allenlinkissue2834 messages
2019-12-26 16:54:31jeff.allencreate