From: Charlie G. <cha...@gm...> - 2007-07-18 20:03:12
|
I added some code before 2.2 rc1 to close Python file objects when they're garbage collected or when Java exits to emulate CPython's behaviour. It should only apply to file objects created and solely referenced from Python, but it's actually affecting all PyFile objects. PySystemState creates a PyFile wrapping System.out, so when the first PySystemState is garbage collected its System.out PyFile is garbage collected and closed. I'm going to try to isolate PyFiles created from Python from files created from Java and keep the closing behaviour, but if I can't I'll just back out the change. In either case, the problem you're seeing will be fixed in rc3. Thanks for tracking this down and reporting it! Charlie On 7/18/07, Michael Chisholm <chi...@mi...> wrote: > We've needed to upgrade to at least jython 2.2 rc1 to take advantage of > other threading fixes, and the output issue mentioned in passing in a > previous post (see > http://www.nabble.com/forum/ViewPost.jtp?post=10750205&framed=y) has now > risen in importance, as it makes it hard to diagnose problems if we > can't see our debug instrumentation output. To restate the problem > here: output to the console works for a short time and then stops. > System.out.println() and python 'print' statements no longer print > anything. It turns out this problem occurs even without using multiple > threads, and even is reproducible without actually having the > interpreter run any script at all. The issue seems to have been > introduced in between 2.2b2 and 2.2rc1, as the program works fine in 2.2b2. > > Of course, you wouldn't normally keep instantiating PySystemState in a > single-threaded program, but in a multi-threaded app where there is one > interpreter instance per thread, which is the case in our project, I > would assume every time you instantiate an interpreter, you get a > PySystemState object instantiated too. The issue must be in > PySystemState, making it hopefully easier for the jython gurus to track > down... :) Any fixes for this would be much appreciated! > > Attached is the test app. On my computer, it only prints to up 20. > Simply comment out the line which instantiates PySystemState and it will > work as expected, printing up to 99. > > Andy > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > > > |