Bug 437122 - Stale launches in Debug view after canceling "Save and Launch" dialog
Summary: Stale launches in Debug view after canceling "Save and Launch" dialog
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.4.1   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 434245
Blocks:
  Show dependency tree
 
Reported: 2014-06-11 08:17 EDT by Markus Keller CLA
Modified: 2014-09-12 11:09 EDT (History)
6 users (show)

See Also:
Michael_Rennie: review+


Attachments
Screenshot (46.85 KB, image/png)
2014-06-13 06:41 EDT, Markus Keller CLA
no flags Details
Patch to remove the cancelled launches from Debug View (1.95 KB, patch)
2014-06-24 08:03 EDT, Sarika Sinha CLA
no flags Details | Diff
Patch to remove the launch if pre check or project build fails (859 bytes, patch)
2014-07-31 09:31 EDT, Sarika Sinha CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2014-06-11 08:17:26 EDT
+++ This bug was initially created as a clone of Bug #434245 +++

See also bug 434245 comment 6.

Steps below also reproduce in 64 bit Eclipse SDK builds with a Java Application launch configuration.

(Dobrin Alexiev from bug 434245 comment #8)
> Here are the steps to reproduce the issue:
> On Windows 7 download and unzip Eclipse “Standard 4.4 RC3 Windows 32 bit”
> from the site: http://www.eclipse.org/downloads/index-developer.php?Luna
> Start eclipse.exe 
> Create a new plugin project. 
> Open and modify of the java source files. Do not save it. 
> Open the “Debug Configuration” dialog. 
> Select “Eclipse Application” on the left pane and create a new instance of
> it. 
> Select the new instance and click on the “Debug” button at the bottom of the
> dialog. 
> When prompted with the “Save and Launch” dialog say Cancel. 
> Switch to “debug” perspective. See how there is one node in the “Debug
> View”. 
> The “Remove All” button and most of the context menu for that launch are
> disabled. 
> Click on the Debug drop down and try launching the same launch configuration
> few more times, but make sure you do not save the file. 
> See how the debug view accumulates launches that are not useful for anything
> and I don’t know how to get rid of them. 
> I was able to remove the launch configuration from the Debug Configuration
> dialog, but all items still remain the debug view. They change to <unknown>
> after I’ve deleted their launch configuration.
Comment 1 Dobrin Alexiev CLA 2014-06-11 09:29:27 EDT
Thank you, Markus, for prioritizing this bug for 4.4.1. 

According to the schedule site: http://wiki.eclipse.org/Luna/Simultaneous_Release_Plan the SR1 release will be at end of September. So the 4.4 release will be with this bug for the first three months. I don’t know how many people will see it and be puzzled by it, or if there is any chance fixing it in RC4 at this time. I also don’t know if will cause issues other than the described here, or affect more severely other debuggers. For sure it did our debugger, which launcher has overwritten preLaunchCheck(). 

In any case I just wanted to note that it has been introduced about three weeks ago, and I think the code change is just adding the launch in the collection earlier, before considering that result from preLaunchCheck(). I just wonder if undoing that change will give the users better Eclipse 4.4 experience for the first three months after the release. 

Regards
Dobrin
Comment 2 Sarika Sinha CLA 2014-06-13 03:36:08 EDT
(In reply to Markus Keller from comment #0)
> +++ This bug was initially created as a clone of Bug #434245 +++
> 
> See also bug 434245 comment 6.
> 
> Steps below also reproduce in 64 bit Eclipse SDK builds with a Java
> Application launch configuration.
> 
> (Dobrin Alexiev from bug 434245 comment #8)
> > Here are the steps to reproduce the issue:
> > On Windows 7 download and unzip Eclipse “Standard 4.4 RC3 Windows 32 bit”
> > from the site: http://www.eclipse.org/downloads/index-developer.php?Luna
> > Start eclipse.exe 
> > Create a new plugin project. 
> > Open and modify of the java source files. Do not save it. 
> > Open the “Debug Configuration” dialog. 
> > Select “Eclipse Application” on the left pane and create a new instance of
> > it. 
> > Select the new instance and click on the “Debug” button at the bottom of the
> > dialog. 
> > When prompted with the “Save and Launch” dialog say Cancel. 
> > Switch to “debug” perspective. See how there is one node in the “Debug
> > View”. 
> > The “Remove All” button and most of the context menu for that launch are
> > disabled. 
> > Click on the Debug drop down and try launching the same launch configuration
> > few more times, but make sure you do not save the file. 
> > See how the debug view accumulates launches that are not useful for anything
> > and I don’t know how to get rid of them. 
> > I was able to remove the launch configuration from the Debug Configuration
> > dialog, but all items still remain the debug view. They change to <unknown>
> > after I’ve deleted their launch configuration.

After following the steps I get only one Launch configuration. I am not getting multiple launch configuration!! And I am able to delete the newly added configuration and I don't get a "unknown" entry .

Just to make sure that there is no other debug plugin in your workspace which contributes to launch dialog and actions?
Comment 3 Markus Keller CLA 2014-06-13 06:38:02 EDT
(In reply to Sarika Sinha from comment #2)
Everything is fine with the launch configuration.
The problem are the stale launches shown in the *Debug* view.
Comment 4 Markus Keller CLA 2014-06-13 06:41:07 EDT
Created attachment 244225 [details]
Screenshot
Comment 5 Sarika Sinha CLA 2014-06-13 07:32:43 EDT
Thanks Markus for the clarification.
Comment 6 Sarika Sinha CLA 2014-06-24 08:03:06 EDT
Created attachment 244467 [details]
Patch to remove the cancelled launches from Debug View

Patch to remove the cancelled launches from Debug View. Currently only terminated launches were removed, now additional method to remove the cancelled launches has been added while adding a new launch.
Comment 7 Dobrin Alexiev CLA 2014-07-30 10:45:53 EDT
This patch will only work with debuggers that are based on the standard debug model. Many debuggers are not like that. Most CDT debuggers are based on the flexible debug hierarchy and the bug will not be fixed for them.

Also I still think it is a break in the promise that when preLaunchCheck is called the new launch is already added in the collection. Do we need fix for “Bug 434245 - Failed to launch run / debug configurations are not added to the "Run/Debug History" https://bugs.eclipse.org/bugs/show_bug.cgi?id=434245  that does not break that promise. I found one issues, but I wander if there are other places in the code the assumes the launch is not yet in the collection?
Comment 8 Sarika Sinha CLA 2014-07-31 09:31:12 EDT
Created attachment 245594 [details]
Patch to remove the launch if pre check or project build fails

This patch removes the launch if precheck of file or build of project fails. Removal of launch does not remove the entry from history.
Comment 9 Dobrin Alexiev CLA 2014-07-31 10:53:53 EDT
Thank you, Sarika!
With this patch on top of the other patches the behavior seems OK under different conditions. I'll continue testing in the next few days.
Comment 12 Sarika Sinha CLA 2014-08-12 07:01:12 EDT
Verified using:
Eclipse SDK

Version: Mars (4.5)
Build id: I20140806-2000

&

Version: Luna SR1 (4.4.1)
Build id: M20140806-0900
Comment 13 Dobrin Alexiev CLA 2014-09-10 14:55:36 EDT
I also noticed another discrepancy from the previous Eclipse version. 
When the launch is added to the launch manager before preLaunchCheck is called ( LaunchConfiguration.java - around line 830 ) the perspective switch will take effect. After that if preLaunchCheck returns false the perspective will remain the Debug perspective. This is a change from previous Eclipse that our users found confusing. Is it possible to fix this this for Eclipse 4.4.1?
Comment 14 Sarika Sinha CLA 2014-09-12 06:49:34 EDT
(In reply to Dobrin Alexiev from comment #13)
Can you provide the steps which changes the perspective ?
Comment 15 Markus Keller CLA 2014-09-12 07:53:32 EDT
You have to set "Preferences > Run/Debug > Perspectives > Open the associated perspective when launching" to "Always". Then launch with an unsaved editor.
I guess the perspective switching code needs to be moved from the pre-launch to the actual launch stage. That would also avoid the stacked dialogs if that preference is set to "Prompt".

Dobrin: This bug is Fixed/Verified, and it's too late for 4.4.1. Please open a new bug.
Comment 16 Dobrin Alexiev CLA 2014-09-12 11:09:04 EDT
Thank you. Here is the new bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=443960