#jython IRC Log (v0.9)

Index

IRC Log for 2017-07-27

Timestamps are in GMT/BST.

[2:03] <lawltoad> jimbaker, https://github.com/facebook/buck/blob/67ff3d62253456e0583ecfb49e4e931206f8cdef/src/com/facebook/buck/cli/Main.java this seems like it might be doable? or does something else confilct with it
[2:04] <lawltoad> also unrelated, how do i set the location of the histfile/size etc?
[3:22] <jimbaker> lawltoad, maybe. it would be worthwhile experiment. the use of JNA makes it doable from python code in jython itself as well
[3:22] <jimbaker> having pty would be nice, no question
[3:25] <jimbaker> in terms of https://docs.python.org/2/library/readline.html#history-file, this functionality should work
[3:26] <jimbaker> you can look at the implementation here - https://github.com/jythontools/jython/blob/master/Lib/readline.py#L54 for example - it simply leverages jline2
[11:58] * eregon_ is now known as eregon
[15:06] * xemdetia (xemdetia@nat/ibm/x-pqgzmalzacapobmm) has joined #jython
[15:22] * xemdetia_ (xemdetia@nat/ibm/x-sebeqwzchaarwknb) has joined #jython
[15:24] * xemdetia (xemdetia@nat/ibm/x-pqgzmalzacapobmm) Quit (Ping timeout: 260 seconds)
[15:25] * xemdetia_ is now known as xemdetia
[15:53] <lawltoad> Wait, I'm confused about "share a thread across multiple PySystemState". Interacting with two different PySystemStates from one thread can have issues?
[15:54] <jimbaker> so in general this is not a problem
[15:54] <lawltoad> I guess I'm curious when it could be
[15:55] <jimbaker> an app server like jetty that jython embedded in it will run requests with a thread pool
[15:55] <jimbaker> such requests are very well defined in terms of their thread usage, and are not doing crazy stuff that can break re-entrancy
[15:56] <lawltoad> (Also, I was looking at http://bugs.jython.org/issue2604; where in it does it call threadLocalStateInterpreter?)
[15:57] <jimbaker> but probably something along the lines of a request kicking off a thread that attempts to share across PySystemState in a subsequent thread - it's pretty artificial in this case, because again the request/response model is so nice and has the bracketed quality
[15:57] <jimbaker> re #2604, this is done by the JSR223 implementation
[15:58] <jimbaker> so for performance, it was trying to re-use PySystemState. but this runs into problems because of shared state - which PySystemState is all about encapsulating!
[15:59] <lawltoad> Ahh, I imagine it's because of potential interleaving calls to static Py.setSystemState() called from Interperater's setSystemState()?
[15:59] <jimbaker> so really there are two things: either share or the state; or create a new one
[15:59] <jimbaker> sure, setSystemState is going to put that on a thread local
[16:00] <jimbaker> JSR223 is a terrible API
[16:00] <lawltoad> Hmm... Theoretically, do you think it's possible to remove the need for thread locals? I still need to take a closer look?
[16:00] <jimbaker> because it is not well defined
[16:01] <jimbaker> thread locals are absolutely essential to how the python language works
[16:01] <lawltoad> I've had projects where I've had to stip out things liek that to fix race conditions
[16:02] <jimbaker> if one can control the codebase, it's reasonable. but the relevant codebase here is the universe of python code
[16:03] <lawltoad> Ah, gotcha.
[16:03] <jimbaker> so threadlocals are necessary for the property that a given thread, given access to the jython runtime, will want to access global state
[16:03] <jimbaker> which happens *all* the time
[16:04] <jimbaker> basically anything global is in that state
[16:04] <jimbaker> modules, builtins, ...
[16:04] <jimbaker> it's what makes python fast, fun, and easy, not to mention dynamic
[16:05] <jimbaker> *fast* to write code in
[16:07] <jimbaker> again this works well. we have lots of codebases written in python, running in jython. but JSR223 is such a terrible API that it exposes some of these problems
[16:07] <lawltoad> gotcha, makes sense. Thanks for the whirlwind tour of the internals. I think I'm getting enough context to start diving in maybe. I don't know what this will do for performance, BUT another way to isolate this sort of thing in a pinch is to isolate class loaders
[16:07] <jimbaker> PySystemState in fact manages those too :)
[16:08] <lawltoad> It'll probably chew up your ram though
[16:08] <jimbaker> oh no, we use ClassLoaders all the time. jython is a great exercise of the ClassLoader implementation :)
[16:08] <lawltoad> well the idea is that each interperater can get it's own static public instance
[16:09] <lawltoad> of PySystemState
[16:09] <jimbaker> i see your point, we could isolate PySystemState itself with a ClassLoader
[16:09] <jimbaker> so in the ClassLoader tree
[16:09] <jimbaker> we move the root up one level
[16:09] <jimbaker> yes, that could be interesting
[16:11] <jimbaker> fwiw, before we finalize jython 3, i hope we could remove all mutable static fields from PySystemState
[16:11] <lawltoad> something like new URLCLassloader("jython-snadnalone.jar").getNewInstanceHowever("PythonInterperater")
[16:11] <jimbaker> yeah, that's basically how an app server would do it
[16:11] <lawltoad> but each Interperater is spawned from it's own classlaoder
[16:11] <lawltoad> Yep, getty does it with wars
[16:11] <lawltoad> *jetty
[17:45] * Gfffdf (5f5bcea5@gateway/web/freenode/ip.95.91.206.165) has joined #jython
[17:55] * Gfffdf (5f5bcea5@gateway/web/freenode/ip.95.91.206.165) Quit (Ping timeout: 260 seconds)
[19:12] * xemdetia_ (xemdetia@nat/ibm/x-dujazvlsdpqxsaih) has joined #jython
[19:15] * xemdetia (xemdetia@nat/ibm/x-sebeqwzchaarwknb) Quit (Ping timeout: 248 seconds)
[21:29] * xemdetia_ is now known as xemdetia
[22:42] * lazybear (~lazybear@radium.atom.fi) Quit (Excess Flood)
[22:44] * [Arfrever] (~Arfrever@apache/committer/Arfrever) Quit (Remote host closed the connection)
[22:44] * [Arfreve1] (~Arfrever@172.97.103.63) has joined #jython
[22:44] * grey__ (eaaltone@kapsi.fi) has joined #jython
[22:44] * topi`_ (topi@kaverit.org) Quit (Write error: Broken pipe)
[22:44] * grey_ (eaaltone@kapsi.fi) Quit (Write error: Broken pipe)
[22:44] * lazybear (~lazybear@radium.atom.fi) has joined #jython
[22:44] * xemdetia (xemdetia@nat/ibm/x-dujazvlsdpqxsaih) Quit (Ping timeout: 276 seconds)
[22:44] * JythonLogBot (~PircBot@74.50.59.201) Quit (Ping timeout: 247 seconds)
[22:44] * JythonLogBot disconnected - trying to reconnect...
[22:44] -tolkien.freenode.net- *** Looking up your hostname...
[22:44] -tolkien.freenode.net- *** Checking Ident
[22:44] -tolkien.freenode.net- *** No Ident response
[22:44] -tolkien.freenode.net- *** Couldn't look up your hostname

Index

These logs were automatically created by JythonLogBot_ on irc.freenode.net using a slightly modified version of the Java IRC LogBot (github).