Bug 409587 - C/C++ Indexer and Discovery Scanner running over and over
Summary: C/C++ Indexer and Discovery Scanner running over and over
Status: REOPENED
Alias: None
Product: PTP
Classification: Tools
Component: RDT.sync (show other bugs)
Version: 7.0   Edit
Hardware: PC All
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-31 09:28 EDT by Brian Watt CLA
Modified: 2018-11-17 08:46 EST (History)
5 users (show)

See Also:


Attachments
Image showing Porgress view with C/C++ Indexer running over and over (48.13 KB, image/jpeg)
2013-05-31 09:29 EDT, Brian Watt CLA
no flags Details
Image showing Progress view when submitting a job while C/C++ Indexer running over and over (78.98 KB, image/jpeg)
2013-05-31 09:58 EDT, Brian Watt CLA
no flags Details
Image of Progress view after Indexer is stopped (50.73 KB, image/jpeg)
2013-05-31 10:10 EDT, Brian Watt CLA
no flags Details
Image of Progress View with recently regenerated discover tasks (89.44 KB, image/jpeg)
2013-06-03 10:45 EDT, Brian Watt CLA
no flags Details
Screen shot of many scanner discovery tasks (91.48 KB, image/png)
2018-11-17 07:10 EST, David Crocker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Watt CLA 2013-05-31 09:28:01 EDT
On the latest Kepler Master branch. 
Client: Red Hat Enterprise Linux Server release 6.2 (Santiago)
Server: Red Hat Enterprise Linux Server release 6.4 (Santiago)

1. I created a new synchronized project to a hello_world program.

2. When the creation was finished I noticed that the C/C++ Indexer was running in the message area at the bottom right corner of the screen.

3. So I opened the progress view and was surprised to see the C/C++ Indexer running constantly and the "Discover compiler built-in language setting (waiting)" occurring over and over and over. See attached image. For the next 5+ minutes as I entered this bug it has not stopped, but continues to span new ones.
Comment 1 Brian Watt CLA 2013-05-31 09:29:33 EDT
Created attachment 231809 [details]
Image showing Porgress view with C/C++ Indexer running over and over
Comment 2 Brian Watt CLA 2013-05-31 09:32:14 EDT
Note: If I try stopping [red square on right] the various tasks then new ones appear and take their place. I cannot ever get it to purge all of these tasks and quiesce. I consider this an important error to fix.
Comment 3 Brian Watt CLA 2013-05-31 09:37:14 EDT
Second Note: If I then try to do a clean or a build, the Clean or Build task takes a long time to complete because it is Build Project (Blocked: The user operation is waiting for "Discover compiler built-in language settings" to complete)
Comment 4 Brian Watt CLA 2013-05-31 09:43:10 EDT
Maybe related the log has:

!ENTRY org.eclipse.cdt.managedbuilder.core 4 0 2013-05-31 08:34:39.678
!MESSAGE Problem running CDT Scanner Discovery provider org.eclipse.ptp.rdt.sync.core.SyncGCCBuiltinSpecsDetector
!SUBENTRY 1 org.eclipse.cdt.managedbuilder.core 4 4 2013-05-31 08:34:39.679
!MESSAGE Error running Builtin Specs Detector
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ptp.internal.remote.remotetools.core.RemoteToolsFileStore.getExecutionManager(RemoteToolsFileStore.java:455)
	at org.eclipse.ptp.internal.remote.remotetools.core.RemoteToolsFileStore.getRemoteItem(RemoteToolsFileStore.java:499)
	at org.eclipse.ptp.internal.remote.remotetools.core.RemoteToolsFileStore.fetchInfo(RemoteToolsFileStore.java:184)
	at org.eclipse.core.filesystem.provider.FileStore.fetchInfo(FileStore.java:280)
	at org.eclipse.ptp.internal.rdt.sync.cdt.core.SyncGCCBuiltinSpecsDetector.getSpecFile(SyncGCCBuiltinSpecsDetector.java:277)
	at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.resolveCommand(AbstractBuiltinSpecsDetector.java:306)
	at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.startupForLanguage(AbstractBuiltinSpecsDetector.java:543)
	at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector.runForEachLanguage(AbstractBuiltinSpecsDetector.java:495)
	at org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector$1.runInWorkspace(AbstractBuiltinSpecsDetector.java:430)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Comment 5 Brian Watt CLA 2013-05-31 09:48:58 EDT
The above may occur because I was banging cancel/stop numerous times on various tasks and they were shutting-down/stopping at weird places. If I stop Eclipse and restart it NO back traces are present until I start canceling/stopping the tasks. When the back traces occur they can be other failures than NPE.
Comment 6 Brian Watt CLA 2013-05-31 09:58:18 EDT
Created attachment 231811 [details]
Image showing Progress view when submitting a job while C/C++ Indexer running over and over
Comment 7 Brian Watt CLA 2013-05-31 10:00:35 EDT
Set Importance to P2 major
Comment 8 Brian Watt CLA 2013-05-31 10:09:45 EDT
Going into Window > Preferences > C/C++ > Indexer I get "Could not Accept Changes: The currently displayed page contains invalid values". If I press OK and then reattempt to select Indexer now I get the Indexer Preference page with nothing set (no checkboxes checked, no indexer choice selected). If I press OK the Indexer task stops running. Now only the "Discover compiler build-in language settings" task is running over and over.
Comment 9 Brian Watt CLA 2013-05-31 10:10:14 EDT
Created attachment 231814 [details]
Image of Progress view after Indexer is stopped
Comment 10 John Eblen CLA 2013-05-31 10:14:07 EDT
How many other projects do you have in your workspace? Last night I fixed bug 409479, so that the sync scanner discovery now runs. So it could be that it is running discovery on all of your projects because it detects that none of them have yet been run. The C/C++ indexing also takes a long time, even on small projects, which would explain the backup of tasks.
Comment 11 Brian Watt CLA 2013-05-31 10:16:01 EDT
One project, the hello world one with hello_world.c of 5 lines.
Comment 12 Brian Watt CLA 2013-05-31 10:22:23 EDT
Just deleted the workspace (runtime-Eclipse) and restarted Eclipse. Created the hello_world synchronized project again afresh and the C/C++ Indexer & Discover scanner started again running over and over.
Comment 13 Brian Watt CLA 2013-05-31 10:25:56 EDT
What is weird is that the Indexer is grossly misstating things like "Indexing: 334/341 sources, 22 headers: parsing hello_world.c (/test_hello_world_Linux_x86_64)" and the hello_world.c program consists of:

/*
 * hello_world.c
 *
 *  Created on: May 8, 2013
 *      Author: bwatt
 */
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
	char name[256] = "";
	gethostname(name, 256);
	printf("Hello World from %s!\n", name);
	sleep(600);
	return 0;
}
Comment 14 Brian Watt CLA 2013-05-31 10:33:10 EDT
Definitely seeing bug 409479 comment 2 "However, removing this causes the scanner discovery/indexer to get into an infinite loop."
Comment 15 John Eblen CLA 2013-05-31 10:35:50 EDT
For me the sync discovery doesn't run at all when the project is created. I have to invoke it manually as described in bug 409479. Then it runs once followed by the indexing. How exactly are you creating the project? What project type and toolchains do you select and what files, if any, are on the remote? Also, what version of CDT are you using?
Comment 16 Brian Watt CLA 2013-05-31 10:54:29 EDT
(In reply to comment #15)
> For me the sync discovery doesn't run at all when the project is created. I
> have to invoke it manually as described in bug 409479. Then it runs once
> followed by the indexing. How exactly are you creating the project? What
> project type and toolchains do you select and what files, if any, are on the
> remote? Also, what version of CDT are you using?

How exactly are you creating the project? 

Right click on Project Explorer area > "New" > "Synchronized C/C++ Project". 

Enter project name: "test_hello_world_Linux_x86_64".

Under "Remote directory" "Connection name": select "k7.pok.ibm.com" from list or create it "New" if connection doesn't exist. 

Under "Remote directory" "Remote directory": select "Browse" and find "/home/bwatt/test_client/remote_projects_linux/test_hello_world_Linux_x86_64". The remote system contains all the files: hello_world.c and Makefile. If already built it also contains hello_world.o and hello_world executable.

Under "Project Type" expand "Makefile project" and select "Empty Project".

Under "Remote Toolchain (select 1 or more)" select "Linux GCC".

Do not select a "Local Toolchain"

Press "Finish"

Also, what version of CDT are you using?

Eclipse C/C++ Development Tools SDK Version: 8.2.0.201305061014
Comment 17 Chris Navarro CLA 2013-05-31 11:00:29 EDT
I haven't tried this out, but I noticed on the last page of the project creation there are some sync setting dropdown menus with nothing selected by default. Could this be causing an issue?
Comment 18 Brian Watt CLA 2013-05-31 11:01:41 EDT
Again deleted the workspace (runtime-Eclipse) and restarted Eclipse. Created the hello_world synchronized project again afresh, but this time WITHOUT specifying any "Remote Toolchain (select 1 or more)". And the Indexer/Discovery Scanner are NOT running over and over. So I can make progress this is a workaround I'll use for the time being until this is fixed.
Comment 19 John Eblen CLA 2013-05-31 11:15:26 EDT
(In reply to comment #17)
> I haven't tried this out, but I noticed on the last page of the project
> creation there are some sync setting dropdown menus with nothing selected by
> default. Could this be causing an issue?
I don't think so, because those settings only affect which build configuration is selected, and in this case there is only one.
Comment 20 Greg Watson CLA 2013-05-31 13:41:59 EDT
I'm seeing a similar issue. I would expect there to be a significant number of header files processed, since system headers include other headers, etc. However, I left the indexing running for a couple of hours, and it is now up to over 9,500 source files and 2,500 headers while indexing shallow/main.c. It does appear that there is some kind of looping problems.
Comment 21 John Eblen CLA 2013-05-31 15:14:54 EDT
I added a lock to prevent multiple threads from running scanner discovery at the same time. Please test and see if this helps.
Comment 22 Brian Watt CLA 2013-05-31 17:31:50 EDT
So I pulled the latest master code, and then I followed the aforementioned scenario after deleting the project from my workspace. The behavior is no different. That is, the C/C++ Indexer begins to run. Over time the Indexing of the sources starts at 0/3 and progress over several minutes to about 360/367 (numbers not exact). Then it resets back to zero and starts all over again. Another time it went even longer and got over 1000/1008 before I finally gave up and stopped Eclipse.
Comment 23 Brian Watt CLA 2013-05-31 17:35:06 EDT
To make sure I have pulled the latest master code to test please tell me the plugin that was affect by your latest change so I can verify that the change in the the history.
Comment 24 Greg Watson CLA 2013-05-31 17:35:33 EDT
Yes, the behavior is still the same for me.
Comment 25 Brian Watt CLA 2013-05-31 17:37:02 EDT
For the org.eclipse.ptp.rdt.sync.cdt.ui the last change I see is:

commit 62692b3596547594489e95eef1ba4a10691ce789
Author: John Eblen <jeblen@acm.org> 2013-05-30 18:47:55
Committer: John Eblen <jeblen@acm.org> 2013-05-30 21:07:40
Parent: c40f9df113d0c2b8a34e548e290728425c52938a (Bug 409395 - Without toolchain selection, New Sync project gives NPE)
Branches: master, origin/master

Bug 409479 - Sync GCC Builtin Compiler Settings not working

Also includes improvements to sync scanner discovery:
1) Do not sync before or after discovering built-in compiler settings
2) Do not share providers between projects
Comment 26 Brian Watt CLA 2013-05-31 17:38:11 EDT
OK, I see it, for org.eclipse.rdt.sync.cdt.core, I see

commit 3980a80c249e726acd14b5fb22105bdba330b373
Author: John Eblen <jeblen@acm.org> 2013-05-31 13:59:18
Committer: John Eblen <jeblen@acm.org> 2013-05-31 14:07:22
Parent: 62692b3596547594489e95eef1ba4a10691ce789 (Bug 409479 - Sync GCC Builtin Compiler Settings not working)
Branches: master, origin/master

Add lock to prevent multiple sync scanner discovery jobs running at
the same time. See bugs 409479, 409587, and 409609.
Comment 27 John Eblen CLA 2013-05-31 18:05:20 EDT
Yes, that is the commit. I think there are two issues: the runaway indexing and the constant adding of new discovery jobs. This commit targets the latter problem. Do you still see lots of discovery jobs in the queue? If so, are there fewer now than before? Unfortunately, I'm not able to reproduce the problem, so I can't see the results for myself.
Comment 28 Brian Watt CLA 2013-06-03 09:32:28 EDT
(In reply to comment #27)
> Yes, that is the commit. I think there are two issues: the runaway indexing
> and the constant adding of new discovery jobs. This commit targets the
> latter problem. Do you still see lots of discovery jobs in the queue? If so,
> are there fewer now than before? Unfortunately, I'm not able to reproduce
> the problem, so I can't see the results for myself.

John, I have not been focusing on the discovery jobs, so I cannot reply to your question since I don't know if there are more or less now. Sorry.
Comment 29 John Eblen CLA 2013-06-03 10:20:14 EDT
(In reply to comment #28)
> John, I have not been focusing on the discovery jobs, so I cannot reply to
> your question since I don't know if there are more or less now. Sorry.
In earlier comments you said that the long list of discovery jobs, which queue behind the indexing job, kept regenerating and that you were unable to purge all of the jobs (comment #2). Does that still occur? My hope is that now there is only one discovery job or at least a finite number, say 7 or 8, and that they do not continually regenerate.
Comment 30 Brian Watt CLA 2013-06-03 10:45:05 EDT
(In reply to comment #29)
> (In reply to comment #28)
> > John, I have not been focusing on the discovery jobs, so I cannot reply to
> > your question since I don't know if there are more or less now. Sorry.
> In earlier comments you said that the long list of discovery jobs, which
> queue behind the indexing job, kept regenerating and that you were unable to
> purge all of the jobs (comment #2). Does that still occur? My hope is that
> now there is only one discovery job or at least a finite number, say 7 or 8,
> and that they do not continually regenerate.

So here is what I see now. 

1. The indexer task is running 48/51 sources...51/54 sources...54/47 sources...
2. There are N discovery task beneath the indexer. Where N is upwards to 10-15 of them (see attachment 4 [details])
3. Over time the discovery tasks complete. 
4. When all discovery tasks complete the indexer is reset to 0/0 sources and N more discovery tasks are created where might be more this time, and the whole things starts over again.

I'd be more than willing to call you and also set up a web conference so you can watch it.
Comment 31 Brian Watt CLA 2013-06-03 10:45:54 EDT
Created attachment 231878 [details]
Image of Progress View with recently regenerated discover tasks
Comment 32 Greg Watson CLA 2013-06-03 11:16:22 EDT
I see similar behavior to Brian. I created a new workspace, then a new synchronized C/C++ project using a remote project that already existed.

1. It looks like the indexer may have started before the synchronization was completed. Not sure if this has any effect.
2. I see the indexed job, then about 10 Discover jobs. Each Discover job completes in turn until they are all done, then another 10 or so appear.
3. The indexer says Indexing: 0/10 sources, then by the time the 10 jobs are done it says something like 4/10 sources. When the second lot of 10 jobs are done, it is now indexing 15/29 sources.
4. The number of sources just keeps increasing. For interest, I let it run all day over the weekend and it got to about 60,000 sources indexed before running out of heap space.
Comment 33 Andrew Gvozdev CLA 2013-06-04 10:26:28 EDT
I can refer to bug 407781 and bug 408541. If somebody can provide reduced reproducible example, I would take a look at looping from CDT side.
Also, bug 406069 might be of interest.
Comment 34 Brian Watt CLA 2013-06-04 10:43:43 EDT
BTW, I am running Eclipse C/C++ Development Tools Version: 8.2.0.201305291013
Comment 35 Greg Watson CLA 2013-06-04 10:56:49 EDT
John, I wonder if we should revert this change? Sync projects kill my whole workspace currently.
Comment 36 Brian Watt CLA 2013-06-04 11:06:53 EDT
Workaround: Created the synchronized project, but WITHOUT specifying any "Remote Toolchain (select 1 or more)". As a result the Indexer/Discovery Scanner DO NOT run over and over.
Comment 37 Greg Watson CLA 2013-06-04 11:17:52 EDT
(In reply to comment #36)
> Workaround: Created the synchronized project, but WITHOUT specifying any
> "Remote Toolchain (select 1 or more)". As a result the Indexer/Discovery
> Scanner DO NOT run over and over.

I presume this is because the remote build configuration is not created, so no scanner discover is run. I guess the other workaround is to manually disable the Sync scanner discovery provider in the Preprocessor Include Paths property page.
Comment 38 John Eblen CLA 2013-06-04 11:31:59 EDT
(In reply to comment #37)
> (In reply to comment #36)
> > Workaround: Created the synchronized project, but WITHOUT specifying any
> > "Remote Toolchain (select 1 or more)". As a result the Indexer/Discovery
> > Scanner DO NOT run over and over.
> 
> I presume this is because the remote build configuration is not created, so
> no scanner discover is run. I guess the other workaround is to manually
> disable the Sync scanner discovery provider in the Preprocessor Include
> Paths property page.
No, a remote toolchain is still created. The sync scanner discovery is only added when the toolchain contains the GCC scanner discovery (the latter is removed). So any non-GCC toolchain will not have the sync scanner discovery.
Comment 39 John Eblen CLA 2013-06-04 11:41:21 EDT
(In reply to comment #35)
> John, I wonder if we should revert this change? Sync projects kill my whole
> workspace currently.
Yes, if we are unable to fix this problem. Fortunately, it should be easy to alter the code to simply not add the sync scanner discovery, no need to revert commits, and it would still be available for the user to add after the project is created.
Comment 40 Greg Watson CLA 2013-06-04 15:25:57 EDT
Will you do this for RC3? It needs to be done today if possible.
Comment 41 John Eblen CLA 2013-06-04 15:52:39 EDT
Okay, sync scanner discovery providers are no longer enabled by default.
Comment 42 Brian Watt CLA 2013-06-04 16:52:06 EDT
Just pulled down the latest code, created a new synchronized project to a hello_world program, and specified Under "Project Type" expand "Makefile project" and select "Empty Project" along with under "Remote Toolchain (select 1 or more)" select "Linux GCC". I am no longer seeing the C/C++ Indexer running constantly and the "Discover compiler built-in language setting (waiting)" occurring over and over and over. 

All fixed. Closing.
Comment 43 Greg Watson CLA 2013-06-04 17:00:10 EDT
Brian, I'd like to keep this open. John has just changed the sync config so that the sync scanner discovery is not enabled by default. This should be enabled by default, so the root cause of the problem still needs to be determined.
Comment 44 Brian Watt CLA 2013-06-04 17:03:01 EDT
Greg, sure, that's your choice. I just wanted to properly respond the immediate comment and issue versus your desire to later address the greater problem. So that's fine by me.
Comment 45 David Crocker CLA 2018-11-17 07:08:16 EST
I use to get this problem occasionally using Eclipse Oxygen C/C++ under Windows 10. Now I am running Eclipse 2018-09 (still under Windows 10) and it is MUCH worse. So bad that I will have to downgrade to a previous version, because I often have to wait 10 minutes or more before I can start a build. Many of the CDT Scanner discovery tasks appear to be duplicates because they use exactly the same command and parameters. See attachment. By the time it has completed some of the scanner discovery tasks, it has usually created several more. Could it be that when the CDT checks to see whether it needs to run scanner discovery, it doesn't check whether it has already launched a task to run exactly the same scanner discovery?
Comment 46 David Crocker CLA 2018-11-17 07:10:39 EST
Created attachment 276602 [details]
Screen shot of many scanner discovery tasks
Comment 47 David Crocker CLA 2018-11-17 08:46:59 EST
(In reply to David Crocker from comment #45)
I may be wrong about this issue being worse in Eclipse 2018-09 than in Oxygen, because I suspect it was triggered by the upgrade to 2018-09, which may have caused Eclipse to initiate discovery simultaneously for multiple configurations of multiple projects (I have 11 projects in the workspace and up to 9 configurations of each). Also I think part of the problem may be a Windows bug or an interaction between Eclipse and Windows whereby creating and launching processes becomes very slow. I left Eclipse running for up to half an hour at a time, and when Eclipse became total unresponsive I attempted to close it, terminated it if it wouldn't close, and rebooted Windows (I had to do this 3 times). Now it's running about as well as Oxygen did, and rarely running compiler discovery.