Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 448860 - During the oomph workspace setup, checking the box "restart if required" does not result in closing the current workspace
Summary: During the oomph workspace setup, checking the box "restart if required" does...
Status: CLOSED FIXED
Alias: None
Product: EPP
Classification: Technology
Component: Automated Error Reporting Client (AERI) (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Daniel Haftstein CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 457245
  Show dependency tree
 
Reported: 2014-10-25 18:25 EDT by Michel Parisien CLA
Modified: 2015-03-06 14:46 EST (History)
4 users (show)

See Also:


Attachments
Log during failure (11.04 KB, text/plain)
2015-01-09 11:29 EST, Adolfo Sanchez-Barbudo Herrera CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Parisien CLA 2014-10-25 18:25:37 EDT
I've tried this with many different of my own setup files, and then I tried it with the out of the box CDO Model Repository setup. The result is always the same. When it is configuring the workspace, oomph has a checkbox you can click called "Restart if required" (not sure of the exact wording, I'm writing this by memory), and whenever I check that and then click the finish button, the current eclipse does not close, resulting in an error in the newly spawned eclipse that the workspace is already being used. I am using build 581 of oomph, the one currently (2013-10-25) available on the website. I think I might have seen this feature work correctly in a video about oomph, so perhaps it is a regression.
Comment 1 Ed Merks CLA 2014-10-27 06:52:48 EDT
We're just calling PlatformUI.getWorkbench().restart() exactly like what's called for the "Restart" action on the File menu.  And this always works well for me (on Windows).  I wonder when you encounter this if the Restart from the File menu has the same problem.  In fact, does Restart from the File menu work at all normally?
Comment 2 Michel Parisien CLA 2014-10-27 07:38:31 EDT
Yes, strangely enough that's what I started ending up doing. I didn't check the box, and would instead go under the menu File > Restart, which worked just fine.
Comment 3 Eike Stepper CLA 2014-11-03 06:24:58 EST
Please also notice that this "Restart if needed" checkbox is not about restarting or not. It only does it automatically (if needed at all) without waiting for the user to press the "Finish" button. The only way of preventing the restart is to uncheck the checkbox (if it is checked) and then click "Cancel".
Comment 4 Michel Parisien CLA 2014-11-04 19:18:06 EST
Yeah, I realized that just recently. Perhaps the label could be changed to something like "Restart automatically if needed"?

So yeah, when the box isn't checked and I click finish, then it does restart correctly, but when the box is checked and I click finish, regardless of whether it is saying it wants to restart, it will still relaunch the same workspace without exiting the current session.

I have not confirmed the last paragraph yet in a controlled setting, this is just based on my memory. I will post another comment once I replicate it exactly as I have outlined.
Comment 5 Eike Stepper CLA 2014-11-08 02:19:40 EST
(In reply to comment #4)
> Yeah, I realized that just recently. Perhaps the label could be changed to
> something like "Restart automatically if needed"?

Note that there's already a tooltip on that checkbox: "Restart the current product if the installation has been changed by setup tasks". But we've noticed that people tend to not read them, so I've changed the label as you suggested:

http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/commit/?id=623df1c95112c30083ab2fa8d5d6b84721e0a0b3

Regarding the more fundamental restart problem that you describe from your memory, we've tried every possible combination (on Windows and MacOS "Mavericks") with and without dirty editors. It just always behaves nicely. I fear we have to close this bug as worksforme until you provide us with the exact steps (and environment description) to reproduce the problem.
Comment 6 Michel Parisien CLA 2014-11-08 07:48:42 EST
Sounds reasonable. I'm sure I'll continue to encounter it a lot in the coming weeks, so I'll narrow down on what's going on.
Comment 7 Michel Parisien CLA 2014-11-08 07:53:12 EST
As for tooltips, yeah I personally read them, but only if I can't guess what the original label means. In this case, I thought I was making a correct assumption about what the checkbox was doing so I didn't introspect, but that assumption was a user error on my part. But IMO I don't think my mistake was something that would be unique to me, so I'm glad you changed the label.
Comment 8 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-08 10:45:37 EST
Hi Folks,

I've seen a similar issue many times as well. I can come up with the following repro I've reproduced twice right now:

OS: Windows 7 64bits
Java: 1.7.0_45-b18 
Oomph Installer: Windows 64bits
Eclipse Package: Eclipse IDE for Committers
Project setup: OCL/Development + OCL/Releng

Once everything is installed/configured:
1. File -> Import... _> Oomph -> Projects Into Workspace
2. Install Oomph project setup
3. When IDE components are installed and the wizard waits (Wizard message: Task execution has successfully completed but requires a restart.  Press Finish to restart now or Cancel to restart later.)
4. Press Finish (I hadn't pressed "Restart automatically if needed" check box)

The IDE doesn't restart and I have to manually kill the JVM.

Please, let me know if additional info can help.

Cheers,
Adolfo.
Comment 9 Eike Stepper CLA 2015-01-08 11:31:00 EST
(In reply to Adolfo Sanchez-Barbudo Herrera from comment #8)

I exactly followed all your steps and couldn't reproduce the problem. All went smoothly and correctly.

Did you have any editors open when you pressed Finish? Unsaved editors?
Comment 10 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-08 11:50:41 EST
(In reply to Eike Stepper from comment #9)
> (In reply to Adolfo Sanchez-Barbudo Herrera from comment #8)
> 
> I exactly followed all your steps and couldn't reproduce the problem. All
> went smoothly and correctly.
> 
> Did you have any editors open when you pressed Finish? Unsaved editors?

Not really. I was dealing with the fresh installed IDE and followed those steps.
Note that the Eclipse closes, but it doesn't start again.
Comment 11 Eike Stepper CLA 2015-01-08 11:52:26 EST
It does for me.
Comment 12 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-09 11:28:57 EST
(In reply to comment #11)
> It does for me.

Can you re-check that you are "Oomphing" an Eclipse for Committer IDE (Mars) ? How are you dealing with the automatic reports ?

I've done more investigations:
- Firstly, it doesn't matter which project to install in first and/or second place. This issue happens to me anyhow. Also note that if I install components via normal "Install New Software...", the issue doesn't happen. The IDE restarts.
- I cleaned workspace log before installing the second oomph project. Then, after looking up the error-log indeed there are some SWTWidget exceptions, from which I could highlight some recommenders code[1]
- Since I know that the Eclipse Committers IDE is installed with the new error reporting functionality, I tried the same installation process explained above but using a different package: Eclipse IDE for Java Developers
- This time the IDE restarted when doing the second project installation.

Without further research, some guesses :
- There is surely some error reporting bug around. e.g. That NPE.
- Perhaps, some oomph activity is triggering the error reporting while shutting down, which doesn't let Eclipse properly shutdown later on.
- Why my repro works for you and it doesn't for me. Perhaps you have preferences installed by oomph related to error reporting which are different to mine. I suggest creating a new windows user and repeat the repro explained above.

I'll attach the whole log in a bit.

[1] Caused by: java.lang.NullPointerException
	at org.eclipse.recommenders.internal.stacktraces.rcp.LogListener$3.run(LogListener.java:165)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
	... 18 more
Comment 13 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-09 11:29:52 EST
Created attachment 249824 [details]
Log during failure
Comment 14 Eike Stepper CLA 2015-01-09 12:08:36 EST
(In reply to Adolfo Sanchez-Barbudo Herrera from comment #12)
> Can you re-check that you are "Oomphing" an Eclipse for Committer IDE (Mars)
> ? 

That's what I've done.

> How are you dealing with the automatic reports ?

What's that?

> Without further research, some guesses :
> - There is surely some error reporting bug around. e.g. That NPE.
> - Perhaps, some oomph activity is triggering the error reporting while
> shutting down, which doesn't let Eclipse properly shutdown later on.

Can you try with that error reporting tool turned off?

> - Why my repro works for you and it doesn't for me. Perhaps you have
> preferences installed by oomph related to error reporting which are
> different to mine. I suggest creating a new windows user and repeat the
> repro explained above.

That could be the cause. IIRC. I use Oomph to disable it in all my workspaces!
Comment 15 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-09 13:05:32 EST
(In reply to comment #14)
> (In reply to Adolfo Sanchez-Barbudo Herrera from comment #12)
> 
> > How are you dealing with the automatic reports ?
> 
> What's that?
> 
Sorry. I meant the error reports. Automatic is just an option.
> 
> Can you try with that error reporting tool turned off?
> 
I was trying different configurations. This is the outcome: 

(Prior to do the second installation step)

- Disable Error Reporting -> Successful restart :)
- Report all errors immediately -> Successful restart
- Ask each time before reporting WITHOUT UI responsiveness detection -> it doesn't restart
- Ask each time before reporting WITH UI responsiveness detection -> it doesn't restart

Adding Marcel...

Cheers,
Adolfo.
Comment 16 Marcel Bruch CLA 2015-01-09 13:34:51 EST
> [1] Caused by: java.lang.NullPointerException
> 	at
> org.eclipse.recommenders.internal.stacktraces.rcp.LogListener$3.
> run(LogListener.java:165)
> 	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> 	at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
> 	... 18 more

I briefly scanned the thread and looked up the location mentioned in the code. I don't have an exact line number match but the method in question seems to be:

private void firstConfiguration() {
        Display.getDefault().syncExec(new Runnable() {
            @Override
            public void run() {
                Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
                Configurator.ConfigureWithDialog(settings, shell);
                PreferenceInitializer.saveSettings(settings);
            }
        });
    }
}

Since you say this error happens on a restart, my guess is that PlatformUI.getWorkbench() or IWorkbench.getActiveWorkbenchWindow() returns null because the workbench is shutting down. The dialog is triggered because some other plugin logged an error message but we are not smart enough to recognize that the workbench is currently shutting down.

I'll need to look at that more closely but it seems to be a safe bet that we are somehow involved in this problem. Thanks for the excellent work nailing down the issue, Adolfo.

Moving to Stacktraces and adding Daniel for triage.
Comment 17 Marcel Bruch CLA 2015-01-09 13:41:42 EST
Daniel, can you try to reproduce this issue?

If you can reproduce it, I think the best solution would be to check whether PlatformUI.getWorkbench().isClosing() and then discard the error somewhere.


Maybe it will suffice to check for that condition in:


 public void logging(final IStatus status, String nouse) {
        try {
            if (!isReportingAllowedInEnvironment() || !isErrorSeverity(status) || <<isWorkbenchClosing()>>) {
                return;
            }


This issue should be fixed before M5.
Comment 18 Daniel Haftstein CLA 2015-01-09 14:40:08 EST
The bug can be reproduced if an error gets logged to our system which was never used before (unconfigured) while the workbench gets restarted from a different thread.

To apologize: This was not really the scenario I had in mind while implementing the configuration :)
I am working on a fix.
Comment 19 Daniel Haftstein CLA 2015-01-09 15:31:56 EST
Uploaded change in gerrit: https://git.eclipse.org/r/#/c/39331/
Comment 20 Eike Stepper CLA 2015-01-10 00:09:32 EST
No need to apologize. Thank you all for the good work!
Comment 21 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-10 05:49:41 EST
Thanks all for the prompt reaction :). Looking forward to testing the fix.

Cheers,
Adolfo.
Comment 22 Marcel Bruch CLA 2015-01-12 05:13:29 EST
Fix has been merged.
Comment 23 Adolfo Sanchez-Barbudo Herrera CLA 2015-01-13 06:16:33 EST
Hi Folks, 

After installing the Error reporting feature from here[1], apart from seeing the new UI :), I can confirm that the issue reported in this bugzilla is not reproduced: The IDE restarts.

Cheers,
Adolfo.

[1] https://hudson.eclipse.org/recommenders/job/org.eclipse.recommenders/simrel=mars/102/artifact/repositories/head/target/repository/