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

Bug 313038

Summary: Includes path lost on restart
Product: [Tools] CDT Reporter: Doug Schaefer <cdtdoug>
Component: cdt-build-managedAssignee: Project Inbox <cdt-build-managed-inbox>
Status: REOPENED --- QA Contact: Jonah Graham <jonah>
Severity: critical    
Priority: P3 CC: eclipse.sprigogin, malaperle, yevshif
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/82321
Whiteboard:
Attachments:
Description Flags
Applied Fix cdtdoug: iplog-

Description Doug Schaefer CLA 2010-05-16 13:12:39 EDT
What steps will reproduce the problem?
1. Create Hello World C++ project, let build and index finish, close down eclipse
2. Start up eclipse again

What is the expected output? What do you see instead?
The include path is lost and #include <iostream> shows a warning.

I found this first in Wascana:
http://code.google.com/a/eclipselabs.org/p/wascana/issues/detail?id=4

But I can reproduce it launching CDT from my Linux workspace too.
Comment 1 Marc-André Laperle CLA 2010-05-16 14:49:21 EDT
I'm using Wascana 1.0 Beta 1 and I can't reproduce it. Anything in the error log?
Comment 2 Sergey Prigogin CLA 2010-05-16 15:18:44 EDT
(In reply to comment #0)
> The include path is lost and #include <iostream> shows a warning.

Have you tried to close and reopen the file after the initial refresh finishes?
Comment 3 Doug Schaefer CLA 2010-05-16 20:41:37 EDT
(In reply to comment #1)
> I'm using Wascana 1.0 Beta 1 and I can't reproduce it. Anything in the error
> log?

No logs. And this is reproducible on every machine I tried. Another important point is to start with a fresh workspace.
Comment 4 Doug Schaefer CLA 2010-05-16 20:50:25 EDT
(In reply to comment #2)
> (In reply to comment #0)
> > The include path is lost and #include <iostream> shows a warning.
> 
> Have you tried to close and reopen the file after the initial refresh finishes?

That works fine. It looks like it's lost when we shut down.

The scanner discovery info is stored in the .sc file in the metadata. Is it not getting loaded any more?
Comment 5 Marc-André Laperle CLA 2010-05-16 21:17:13 EDT
(In reply to comment #3)
> (In reply to comment #1)
> > I'm using Wascana 1.0 Beta 1 and I can't reproduce it. Anything in the error
> > log?
> 
> No logs. And this is reproducible on every machine I tried. Another important
> point is to start with a fresh workspace.

Thanks, that did it.
Comment 6 Sergey Prigogin CLA 2010-05-17 03:38:35 EDT
(In reply to comment #3)

I'm also seeing it.
Comment 7 Doug Schaefer CLA 2010-05-17 12:27:17 EDT
Ugh. I just did the same test in Galileo and it fails there too.
Comment 8 Doug Schaefer CLA 2010-05-17 14:06:42 EDT
First thing I see in the debugger: The first project created in a workspace is broken. All others after are fine.

The fMap variable in ScannerConfigInfoFactory2 seems to be incomplete in the first one. There are no 'scannerConfigBuildInfo' records written to the .cproject file.
Comment 9 Andrew Gvozdev CLA 2010-05-17 14:55:07 EDT
(In reply to comment #8)
> First thing I see in the debugger: The first project created in a workspace is
> broken. All others after are fine.
> The fMap variable in ScannerConfigInfoFactory2 seems to be incomplete in the
> first one. There are no 'scannerConfigBuildInfo' records written to the
> .cproject file.
That reminds me of bug 243564 and bug 265692
Comment 10 Doug Schaefer CLA 2010-05-17 15:42:11 EDT
Next data point:

In CfgScannerConfigInfoFactory2.CfgInfo.createMap() line 180

First time through inputType.isExtensionElement is true, i.e. it's the one from the build definition. Thus the info never gets created.

Second time through, inputType.isExtensionElement is false, and we're good.

Off to the next round of debug stack...
Comment 11 Doug Schaefer CLA 2010-05-17 17:09:52 EDT
Last step for going home for supper.

First time through, the NotificationManager is created and the listener set is empty.

By the time the second project is created, the ConfigurationDataProvider is registered as a listener who then takes care of updating the inputType for the tool.

It gets created and registered later on when the MBSWizardHandler.createProject does a setProjectDescription after the configuration is created which is too late.

BTW, what the hell is all this stuff? Why is this thing that's lazily loaded through an extension point responsible for setting up the configuration instance for the inputType of a tool, and why does that cause a mysterious string of supposedly unrelated events that cause the missing scannerConfigBuildInfo, which then causes the missing built-in include path. Ugh!!!!
Comment 12 Doug Schaefer CLA 2010-05-17 22:10:59 EDT
Created attachment 168851 [details]
Applied Fix

I've committed the attached patch. It moves the init of the config data provider to bundle start time. Doesn't seem to be much data created and it's solely dependent on what extensions are defined so it shouldn't slow start up time noticeably.

Please review and comment. I can always revisit the solution.
Comment 13 Doug Schaefer CLA 2010-05-17 22:11:25 EDT
Marking fixed for now.
Comment 14 CDT Genie CLA 2010-07-28 15:28:04 EDT
*** cdt cvs genie on behalf of dschaefer ***
Bug 313038 - Includes path lost on restart. Moved the init of the config data provider to bundle start time so it's ready in time for first project creation.

[*] CProjectDescriptionManager.java 1.88 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CProjectDescriptionManager.java?root=Tools_Project&r1=1.87&r2=1.88
[*] CConfigurationDataProviderDescriptor.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/CConfigurationDataProviderDescriptor.java?root=Tools_Project&r1=1.5&r2=1.6
Comment 15 Eclipse Genie CLA 2016-10-01 17:16:05 EDT
New Gerrit change created: https://git.eclipse.org/r/82321
Comment 16 Sergey Prigogin CLA 2016-10-01 17:18:10 EDT
The fix for this bug triggered bug 503012. Reopened.