From: Jim B. <jim...@py...> - 2017-06-13 19:00:14
|
Tobias, I took a detailed look at http://bugs.jython.org/issue2513. Unfortunately there is no easy fix for this problem as stated, because org.python.jsr223.ScriptEngine, via org.python.util.PythonInterepreter, relies on org.python.core.PySystemState (= sys in Python), which effectively collects together global state for Python, either directly, such as sys.stdout, or indirectly, via sys.modules and any globals within those modules. The mechanism that ScriptEngine uses to put locals on a thread local will not work here, because this is maintained by a separate entity in Python, the frame object (= PyFrame in Jython); there is no such support for sys.stdout, etc, to be looked up from the thread. There is a possible solution, but it's not feasible at this point in the release cycle and needs to be deferred to later. Instead of always attempting to reuse PySystemState, Jython's JSR223 should instead support a model where new PySystemState objects can be attached to a ScriptEngine. I believe this is similar to what Nashorn supports with its --global-per-engine property (also configurable some other ways, see the notes). Regardless of exact similarity, this is how we would have to do it: ScriptEngine engine = factory.getScriptEngine(new String[] { "--global-per-engine" }); (https://wiki.openjdk.java.net/display/Nashorn/Nashorn+jsr223+engine+notes) We should be able to implement this for 2.7.2; and also maybe we can speed up the cadence for 2.7.2. I don't see why that is not possible: a 6 month release cycle is still a very good idea, we just had too many problems we identified during 2.7.1 that kept pushing us back, plus changing time availability by contributors (certainly the case for me!). Lastly, for Jython 3, we may want to revisit some of our APIs like PySystemState so that they can be less global, lighter weight, and have better lifecycle management, while still maintaining their Python semantics. (So not easy!) - Jim On Tue, Jun 13, 2017 at 3:19 AM, <Tob...@dl...> wrote: > Is there any chance that a bug fix for issue 2513 [0] can still be > included in Jython 2.7.1? This bug in Jython's JSR 223 implementation > prevents parallel execution. Therefore, the execution of Jython scripts is > in our application guarded by a global lock, which is a performance > bottleneck. A fix would be a great improvement for us! > > > > Tobias > > > > [0] http://bugs.jython.org/issue2513 > > > > > > *Von:* Jim Baker [mailto:jim...@py...] > *Gesendet:* Freitag, 9. Juni 2017 07:35 > *An:* Jython Developers; jyt...@li... > *Betreff:* [Jython-dev] Need for one more release candidate for Jython > 2.7.1 > > > > So it looks like we will need a RC3 for Jython 2.7.1, given the following > two bugs: > > - http://bugs.jython.org/issue2596 - Linebreaks in exceptions are > wrong - PENDING > - http://bugs.jython.org/issue2593 - file.write(obj) if obj is not a > str or buffer raises j.l.NullPointerException - OPEN > > #2596, now fixed in master, is just the sort of bug that may scramble > existing user tests (although multi-line messages are relatively rare). > #2593 has an easy path to raising a NullPointerException that can come up > in common Python code. But it should be very straightforward to guard > against, so we should have a fix for it momentarily I would assume. > > > > And that is it. There are exactly 301 other bugs that are open, as I write > this email, so clearly we have plenty of work to consider in the future. > But in my judgment, we are about there for a final release. > > > > But it's still not too late to submit a bug against RC2! Please test > against the download links on Frank's blog post: http://fwierzbicki. > blogspot.com/2017/06/jython-271-rc2-released.html > > > > - Jim > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-dev > > |