Issue1870039

classification
Title: Debugging facility not behaving correctly with threads
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, fabioz
Priority: normal Keywords:

Created on 2008-01-12.19:51:02 by fabioz, last changed 2008-01-13.19:21:44 by cgroves.

Files
File name Uploaded Description Edit Remove
test_tracing_in_threads.py fabioz, 2008-01-12.19:51:02 Test case for error
Messages
msg2056 (view) Author: Fabio Zadrozny (fabioz) Date: 2008-01-12.19:51:02
A bug has been reported against pydev: http://sourceforge.net/tracker/index.php?func=detail&aid=1869450&group_id=85796&atid=577329
and the bug seems to lie in the jython handling of the debugging facility.

Within the pydev debugger, I've observed that after that breakpoint is triggered the first time, the trace_dispatch method that is set through sys.settrace is no longer called.

I've tried going a bit deeper into jython and discovered that when I have a thread and try to run it untraced, jython not only runs that thread untraced, but all the other ones too (it seems that the debug tracing facility is set globally instead of per-thread -- which is the python behaviour).

Pydev tries to run with some threads traced and other not (as this can affect the performance of the debugger a lot), but this feature can't be used from jython (so, debugging can get quite a lot slower).

I've attached a file with a test-case for that.

Also, currently pydev only runs well when each thread has its system state set in each thread (it seems to deadlock if I don't do that in Jython -- just mentioning because I thought it might be related).

import org.python.core as PyCore #@UnresolvedImport
ss = PyCore.PySystemState()
# Note: Py.setSystemState() affects only the current thread.
PyCore.Py.setSystemState(ss)
msg2057 (view) Author: Charlie Groves (cgroves) Date: 2008-01-13.09:26:38
It sounded like this was the same problem that http://jython.org/patches/1841378 fixed, and with your test case I was able to see that it did indeed fix it. With that confirmation, I applied that patch to trunk in r4022 and to the 2.2 branch in r4023.  Everything appears to be copacetic now.  Thanks for the test case!
msg2058 (view) Author: Fabio Zadrozny (fabioz) Date: 2008-01-13.11:02:35
That was fast ;-)

So, I can check from the debugger if 'jython version > 2.2.2' to use it with untraced threads? Or will it be applied to a previous version?

Thanks,

Fabio
msg2059 (view) Author: Charlie Groves (cgroves) Date: 2008-01-13.19:21:44
Well, if I had good patches for all of the bugs in Jython, I could get through all of them this quickly :)  version >= 2.2.2 should be the right check.  It definitely won't be applied to any already released versions.
History
Date User Action Args
2008-01-12 19:51:02fabiozcreate