You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I observed this bug with an experimental JSR223 jpy interpreter, with the debug mode enabled (that corresponds to launching the JVM with -Djpy.debug=true as specified in the jpy 0.9.0 readthedocs manual)
I insist that this bug was not introduced by this new (and far from complete) interpreter (that is just a shell script based on the standard JDK jrunscript tool for JSR223 compliant implementations), but simply revealed by it. Here is how to reproduce the bug easily:
clone or download the following jpy fork (it is simply jpy 0.12.0 with JSR223 support, not yet integrated to the official fork) and a jpyinterp.sh interpreter,
In debug mode (-Djpy.debug=true), the evaluation of any python command (import, print, etc) ends up in an infinite loop (example below with import math)
HINT: in order to see what ./jpyinterp.sh -D does, one can leverage the bash -x option:
$ bash -x ./jpyinterp.sh -Djpy.debug=true
On my system, it is equivalent to the following command (of course, paths will be different on another system): jrunscript -Djpy.pyLib=/usr/local/Cellar/[email protected]/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin/libpython3.10.dylib -Djpy.jpyLib=/Users/ducos/Projects/jpy/build/lib.macosx-12-x86_64-3.10/jpy.cpython-310-darwin.so -Djpy.jdlLib=/Users/ducos/Projects/jpy/build/lib.macosx-12-x86_64-3.10/jdl.cpython-310-darwin.so -cp target//jpy-0.12.0-SNAPSHOT.jar -l python -Djpy.debug=true
EDIT:
The bug occurs ONLY in interactive mode. It DOES NOT occur when executing a script, even in debug mode: ./jpyinterp.sh -Djpy.debug=true hello.py
(where hello.py is a simple file containg a print("Hello JPy") statement)
The text was updated successfully, but these errors were encountered:
I haven't run this myself, but I don't think it's an infinite loop - my guess is you could type something else in, hit enter, and it would "work" (you might not be able to clearly see what you are typing though). I think all the extra logging you are seeing is coming from a java thread that is always running and is responsible for ensuring objects get cleaned up.
That said, I definitely see how this is probably not what you want to happen in an interactive session. Ideally, you'd only see the debug activity from the commands you enter.
I have just tested your assumption and it is perfectly right. It is still possible to type commands in the interpreter, but the output never ends spamming the screen. The commands keep being interpreted though.
devinrsmith
changed the title
jpy enters in an infinite loop in debug mode (-Djpy.debug=true)
jpy debug logging does not work well within interactive environments
Jul 19, 2022
I observed this bug with an experimental JSR223 jpy interpreter, with the debug mode enabled (that corresponds to launching the JVM with -Djpy.debug=true as specified in the jpy 0.9.0 readthedocs manual)
I insist that this bug was not introduced by this new (and far from complete) interpreter (that is just a shell script based on the standard JDK
jrunscript
tool for JSR223 compliant implementations), but simply revealed by it. Here is how to reproduce the bug easily:jpyinterp.sh
interpreter,python setup.py build maven bdist_wheel
In normal mode, everything behaves as expected:
In debug mode (-Djpy.debug=true), the evaluation of any python command (import, print, etc) ends up in an infinite loop (example below with
import math
)HINT: in order to see what
./jpyinterp.sh -D
does, one can leverage thebash -x
option:$ bash -x ./jpyinterp.sh -Djpy.debug=true
On my system, it is equivalent to the following command (of course, paths will be different on another system):
jrunscript -Djpy.pyLib=/usr/local/Cellar/[email protected]/3.10.1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin/libpython3.10.dylib -Djpy.jpyLib=/Users/ducos/Projects/jpy/build/lib.macosx-12-x86_64-3.10/jpy.cpython-310-darwin.so -Djpy.jdlLib=/Users/ducos/Projects/jpy/build/lib.macosx-12-x86_64-3.10/jdl.cpython-310-darwin.so -cp target//jpy-0.12.0-SNAPSHOT.jar -l python -Djpy.debug=true
EDIT:
The bug occurs ONLY in interactive mode. It DOES NOT occur when executing a script, even in debug mode:
./jpyinterp.sh -Djpy.debug=true hello.py
(where
hello.py
is a simple file containg aprint("Hello JPy")
statement)The text was updated successfully, but these errors were encountered: