Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 84586

Summary: Launch doesn't wait for build if launching while "cleaning" before build
Product: [Eclipse Project] Platform Reporter: Darin Wright <darin.eclipse>
Component: DebugAssignee: Jared Burns <jared_burns>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cocoakevin, john.arthorne
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
screen shot none

Description Darin Wright CLA 2005-02-07 11:50:38 EST
If I launch from the Java perspective while a build is in progress, and then 
switch to the debug perspective, no dummy launch appears (although the 
progress view shows a pending launch).
Comment 1 Jared Burns CLA 2005-02-07 12:37:06 EST
Can't reproduce. Can you provide detailed steps?
Comment 2 Darin Wright CLA 2005-02-07 13:05:48 EST
(put in wrong bug)

* launch workbench
* switch to Java persepctive
* start a long build (clean all)
* launch last, in debug mode
* switch to debug persepctive (manually)
> nothing in debug view, but progress view shows launch is pending on build
Comment 3 Darin Wright CLA 2005-02-07 13:06:23 EST
Created attachment 17732 [details]
screen shot 

see empty debug view, and progress view
Comment 4 Jared Burns CLA 2005-02-07 13:39:49 EST
I still can't reproduce.

The "dummy launch" is just a launch that's added to the launch manager. If the
debug view isn't showing it, it shouldn't show any other launches either. You
should be able to reproduce this bug without a build going since we're just
adding a launch in both cases.
Comment 5 Darin Wright CLA 2005-02-07 13:58:09 EST
A regular launch appears for me. In fact, I found that starting from the debug 
persepctive with a empty view causes the same thing. Looking more closely, 
it's because the launch is in the state of building, rather than waiting for 
the build even thought it was launched after the build started.
Comment 6 Darin Wright CLA 2005-02-09 09:01:57 EST
If the launch is performed while the "clean" before a build is occurring, the 
launch job is pending, but no dummy launch appears. I'm not sure how we can 
tell if an active job will trigger a build, and thus, when/if to insert the 
dummy launch in these cases.
Comment 7 Jared Burns CLA 2005-02-09 11:22:32 EST
This isn't a "dummy launch" problem. It's just a launching problem. We don't
wait for a build to finish if it's in the clean state.

Logically, I'd expect that if I click "Clean..." then "Launch", those two things
should happen serially (with the prefs set accordingly).
Comment 8 Jared Burns CLA 2005-02-09 16:48:04 EST
Adding JohnA for comment. To wait for the build to finish, we're currently calling:
  jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, monitor);
  jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, monitor);

I looked at the ResourcesPlugin constants, but didn't see anything related to
the "cleaning" state. Is there some way for us to wait for the entire operation
(clean + build)?
Comment 9 Darin Wright CLA 2005-02-09 16:53:28 EST
NOTE: the behavior I see is that the launch does wait for the clean + build, 
(since the launch triggers a build itself). The problem is that we cannot 
detect that it's going to wait for the build to finish when the "clean" is in 
progress and before the build starts, because there's not BUILD family jobs in 
the queue.
Comment 10 John Arthorne CLA 2005-02-09 16:56:36 EST
"Clean" falls under FAMILY_MANUAL_BUILD.  The clean action in the UI was not
honouring this setting though.  I have released a fix to HEAD in
org.eclipse.ui.ide (about a minute ago).
Comment 11 Jared Burns CLA 2005-02-09 17:09:51 EST
DW, the launch won't wait if you turn off the option to build before launching. :-)

JohnA, coolies. One question, though. Will the clean + build act like one
operation? The behavior we want is:
1. Start clean.
2. Join on build.
3. Finish clean.
4. Start build.
5. Join returns. Proceed with launch.

If the clean and build are separate, we'd get:
1. Start clean.
2. Join on build.
3. Finish clean.
4. Join returns. Proceed with launch.
5. Start build.
Comment 12 Jared Burns CLA 2005-02-09 17:24:58 EST
I just checked out the ui.ide plugin and it looks like we're getting the latter.
My test case:
1. Turn off the "Build before launching" option.
2. Select "Project > Clean...". Choose to clean the entire workspace.
3. Press F11 to relaunch.
4. When the Clean finishes, the launch proceeds (while the build is getting
started).
Comment 13 John Arthorne CLA 2005-02-09 17:30:14 EST
Try reversing your joins.  When autobuild is turned on, the autobuild starts at
the end of the clean.  In your code it looks like you joing autobuild first, and
manual build (clean) second.  Thus you're not catching the autobuild that starts
after the clean finishes.
Comment 14 Jared Burns CLA 2005-02-09 17:33:57 EST
I'll try that, thanks. Adding Kevin for comment because I think he was the one
who wrote the current joins. Is there any reason for the current ordering?
Comment 15 Jared Burns CLA 2005-02-09 17:34:57 EST
Reversing the ordering seems to fix the bug. I'll wait to hear from Kevin before
releasing in case there are any side effects I haven't considered.
Comment 16 Kevin Barnes CLA 2005-02-09 17:39:03 EST
I didn't realize the order of the joins mattered. There is no reason to the current ordering.
Comment 17 Jared Burns CLA 2005-02-09 18:06:32 EST
Fixed in DebugUIPlugin. Please verify, DW.
Comment 18 Darin Wright CLA 2005-02-10 09:21:24 EST
Verified.
Comment 19 John Arthorne CLA 2005-02-10 14:43:50 EST
I noticed that you have this join code in two methods
(DebugUIPlugin.launchInBackground and launchInForeground).  I suspect you'll
want to fix up the order in both?
Comment 20 Darin Wright CLA 2005-02-10 14:50:16 EST
Of course.
Comment 21 Darin Wright CLA 2005-02-10 14:53:02 EST
Fixed in DebugUIPlugin.
Comment 22 Darin Wright CLA 2005-02-10 14:53:26 EST
Please verify, Jared.