Message10033

Author JanVok
Recipients JanVok, kevinmcmurtrie, zyasoft
Date 2015-05-07.15:42:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431013377.79.0.371838222472.issue2321@psf.upfronthosting.co.za>
In-reply-to
Content
Jim, I am afraid that Jython has to do something about it :) Please read carefully.

The issue is that the map is *not* a "weak-map" Thread -> PySystemState...

It is a "weak-map" Thread -> ThreadState

What is occurring is the following:
1. Py.setSystemState calls ThreadStateMapping.getThreadState 
2. which is creating a ThreadState instance... that 
3. *never gets* out of Py.setSystemState!!
4. As a local variable, it is garbage collected very early
5. The ThreadState is evicted from the "weak-map" since the value is GCed
6. Any time later, if I call Py.getSystemState, the "weak-map" does not find an entry for my thread
7. Py.getSystemState returns Py.defaultSystemState

So how do you want us to fix anything without a change in Jython?? I already keep a strong ref to the PySystemState... there's nothing I can do more outside of Jython.
History
Date User Action Args
2015-05-07 15:42:57JanVoksetmessageid: <1431013377.79.0.371838222472.issue2321@psf.upfronthosting.co.za>
2015-05-07 15:42:57JanVoksetrecipients: + JanVok, zyasoft, kevinmcmurtrie
2015-05-07 15:42:57JanVoklinkissue2321 messages
2015-05-07 15:42:57JanVokcreate