Community
Participate
Working Groups
Build Identifier: M20101013-0800 With the default settings on the "perspective switch preference" it is possible to launch a debug session... be prompted to switch perspectives and in the meantime the Debug View is added to the current perspective. this can happen if an IDebugTarget sends a suspend event. The perspective switch processing queues thread suspend events (I assume this is so that the debuggee is held up by the first thread suspend event while the user takes their time answering the dialog) The easiest way to get an IDebugTarget suspend event is to add a breakpoint to a java testcase and change the breakpoint to suspend the JVM. The most annoying side-effect of adding the debug view to a perspective is the activation of the Debug Command Group (see customize perspective). When a debug session is running the F5 key becomes the step into command and can no longer refresh a view. One customer in particular wanted this fixed. Reproducible: Always Steps to Reproduce: 1.using simple Java testcase add a breakpoint and enable suspend JVM 2.in a non-debug perspective launch the Java testcase 3.The Confirm Perspective Switch dialog is displayed and the debug view will be added to the current perspective. 4.Change the breakpoint to suspend thread and try again. The debug view will not be added until after the perspective switch.
Created attachment 181187 [details] patch The problem is caused by the fact that the perspective switching manager receives two requests to handle a swtich - one from the thread suspend event and the other from the target suspend event. The same problem could happen if two different threads suspended in rapid succession.
This patch ignores subsuquent requests to switch if a switch is already being processed for the same launch.
I was not seeing the problem when 2 or more thread suspend events were sent. In my testcase I on purpose left up the perspective switch dialog while my application under debug sent more thread suspend events and I never saw the debug view getting added to the current perspective. Only when a thread suspend AND a target suspend were sent did I see the problem. Not sure that affects your fix strategy but thought I would mention it. NOTE: My debugger always sends 2 thread suspend events at session startup and when I suppressed the target suspend I didn't see the problem.
With this sample program I see the wrong behavior with two threads suspending at separate times. Just launch and wait for 4-5 seconds. public class Two { class Suspend implements Runnable { public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { } System.out.println("Suspend"); // BREAKPOINT } } public static void main(String[] args) throws InterruptedException { new Two().go(); } public void go() throws InterruptedException { Thread t1 = new Thread(new Suspend()); Thread t2 = new Thread(new Suspend()); t1.start(); Thread.sleep(4000); t2.start(); t1.join(); t2.join(); } }
The proposed patch removes the support to run a job after a perspective switch (which was added by bug 87587). I could find no users of this API, but to be safe, I should probably add the support back in.
Created attachment 181201 [details] patch This patch uses jobs and scheduling rules to handle the perspective switch request serially. It also schedules "post switch" jobs serially.
Released to HEAD (second patch using scheduling rules). Fixed.
Verified.
Based on the tests from Alan, the problem does not seem to be resolved. Could you please provide some information as to how we can resolve this issue since there is a customer waiting for a resolution of this problem? Thanks, Farzi.
(In reply to comment #9) > Based on the tests from Alan, the problem does not seem to be resolved. Which build did you test with?
I am sorry Alan verified that this fix is complete but it uncovered another problem in the debug core and he will be opening a bug for it soon. Farzi.