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

Bug 107821

Summary: Indexer crashes Eclipse on code from www.boost.org
Product: [Tools] CDT Reporter: Tomas Lidén <tomas.liden>
Component: cdt-coreAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: cdtdoug, gheorghe, oleg.krasilnikov
Version: 3.0   
Target Milestone: 4.0 RC4   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
Code producing the crash - part 1
none
Code producing the crash - part 2
none
bandaid for this PR (for CTags) cdtdoug: iplog+

Description Tomas Lidén CLA 2005-08-24 05:15:04 EDT
I will attach a tar-file with some of our base classes. It also includes a 
large number of files from boost.org. If you remove the library Basic/Boost, 
everything works fine, but when you include it the (full) indexer will crash 
Eclipse with a java-core. When running with the CTags indexer you get the 
following stack:
java.lang.ClassCastException: org.eclipse.core.internal.resources.Project
        at 
org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsFileReader.parse
(CTagsFileReader.java(Compiled Code))
        at 
org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexAll.execute
(CTagsIndexAll.java:115)
        at org.eclipse.cdt.internal.core.search.processing.JobManager.run
(JobManager.java:466)
        at java.lang.Thread.run(Thread.java:567)
Comment 1 Tomas Lidén CLA 2005-08-24 05:48:31 EDT
Created attachment 26398 [details]
Code producing the crash - part 1

zip:ed tar file created with gtar cvfz
Comment 2 Tomas Lidén CLA 2005-08-24 05:49:51 EDT
Created attachment 26399 [details]
Code producing the crash - part 2
Comment 3 Tomas Lidén CLA 2005-08-24 09:35:18 EDT
I've found a workaround... By setting an exclusion filter on the source code 
(under C/C++ Project Paths, tab "Source") that excludes 
Optimization/Basic/Boost/boost/** the indexer will never try to index the code 
from boost.org, and the crash is avoided.

However, the original problem is of course there... During my experimenting it 
seems that the indexer always crashes when working with variant.hpp and 
variant/**.

Btw, my java -version says:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM build cxia321420-20040626 (JIT enabled: 
jitc))
Comment 4 Devin Steffler CLA 2005-08-24 10:47:08 EDT
What do you mean by "crash Eclipse"?  I'm assuming that you mean that Eclipse 
freezes or closes.  I can't reproduce this in Windows but I'll give Linux/GTK a 
try.

I get a ClassCastException with the CTags indexer that seems to halt the CTags 
indexer and prevents anything from going into the index.
java.lang.ClassCastException: org.eclipse.core.internal.resources.Project
	at 
org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsFileReader.parse
(CTagsFileReader.java:85)
	at 
org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexAll.execute
(CTagsIndexAll.java:115)
	at org.eclipse.cdt.internal.core.search.processing.JobManager.run
(JobManager.java:466)
	at java.lang.Thread.run(Thread.java:534)

I see several ClassCastExceptions with the boost source code with the full 
indexer (but no crash):
java.lang.ClassCastException: 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionTemplate.takesVarArgs
(CPPFunctionTemplate.java:369)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.IndexVisitorUtil.getParamet
ers(IndexVisitorUtil.java:231)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.pro
cessNameBinding(CPPGenerateIndexVisitor.java:316)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.pro
cessName(CPPGenerateIndexVisitor.java:169)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.CPPGenerateIndexVisitor.vis
it(CPPGenerateIndexVisitor.java:112)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName.accept
(CPPASTName.java:90)
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName.accept
(CPPASTQualifiedName.java:175)
	at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTDeclarator.accept
(CPPASTDeclarator.java:126)
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTFunctionDefinition.accept
(CPPASTFunctionDefinition.java:92)
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTemplateDeclaration.accept
(CPPASTTemplateDeclaration.java:95)
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNamespaceDefinition.accept
(CPPASTNamespaceDefinition.java:87)
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNamespaceDefinition.accept
(CPPASTNamespaceDefinition.java:87)
	at 
org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit.accept
(CPPASTTranslationUnit.java:520)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.DOMSourceIndexerRunner.inde
xFile(DOMSourceIndexerRunner.java:133)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.AbstractIndexerRunner.index
(AbstractIndexerRunner.java:76)
	at org.eclipse.cdt.internal.core.index.cindexstorage.Index.add
(Index.java:110)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.DOMAddCompilationUnitToInde
x.indexDocument(DOMAddCompilationUnitToIndex.java:29)
	at 
org.eclipse.cdt.internal.core.index.domsourceindexer.DOMAddFileToIndex.execute
(DOMAddFileToIndex.java:60)
	at org.eclipse.cdt.internal.core.search.processing.JobManager.run
(JobManager.java:466)
	at java.lang.Thread.run(Thread.java:534)
Comment 5 Devin Steffler CLA 2005-08-24 14:47:51 EDT
Try running Eclipse with more virtual machine memory:
./eclipse -vmargs -Xmx512M

This should fix your problem with the full indexer.  It's because you are 
working with such a large project that you need to have more memory reserved 
for the virtual machine than default.

Comment 6 Devin Steffler CLA 2005-08-24 15:02:53 EDT
Created attachment 26418 [details]
bandaid for this PR (for CTags)

I'm not sure why the fileName is "" and this patch is probably just a bandaid
to the problem.  When applied, the CTags index for the attached project goes
from 0 IEntryResults and 0 files indexed to 55350 IEntryResults and 2862 files
indexed with this patch for CTags.
It also fixes the ClassCastException.
Comment 7 Tomas Lidén CLA 2005-08-25 03:51:44 EDT
Sorry, increasing the memory does not help for me (I've tried 1024M as well). 
The full indexer still crashes (again the last file mentioned is variant.hh). 
By "crashing" I mean that I get the following:
Unrecoverable Stack Overflow: addr=b7351ddf, ee=b20aed10, er=b21e2b00
JVMDG217: Dump Handler is Processing a Signal - Please Wait.
JVMDG303: JVM Requesting Java core file
JVMDG304: Java core file written 
to /users/liden/javacore.20050825.093552.11117.txt
JVMDG215: Dump Handler has Processed Exception Signal 11.

Do you want the core file?

Sometimes I also get a stack that starts with:
java.lang.IllegalArgumentException:
        at
org.eclipse.core.internal.runtime.Assert.isLegal(Assert.java(Inlined
Compiled Code))
        at
org.eclipse.core.internal.runtime.Assert.isLegal(Assert.java(Inlined
Compiled Code))
        at
org.eclipse.core.runtime.Path.removeFirstSegments(Path.java(Compiled Code))
        at
org.eclipse.cdt.make.internal.core.scannerconfig.gnu.ScannerInfoConsoleParse
rUtility.translateRelativePaths
(ScannerInfoConsoleParserUtility.java:219)
        at
org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsolePa
rser.processSingleLine(GCCScannerInfoConsoleParser.java:138)
        at
org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsolePa
rser.processLine(AbstractGCCBOPConsoleParser.java:118)
        at
org.eclipse.cdt.internal.core.ConsoleOutputSniffer.processLine(ConsoleOutput
Sniffer.java:178)
...

(Now I will try the CTags bandaid..)

Comment 8 Tomas Lidén CLA 2005-09-01 03:54:49 EDT
I gave up regarding the bandaid, since it requires me to get the source code, 
patch and rebuild the appropriate CDT parts - too much work for me...

For us this is a rather serious problem - hoping to hear more from you soon!
Comment 9 Doug Schaefer CLA 2005-09-01 10:32:10 EDT
I have started looking at this and have a couple of questions. First, what is 
part1 and what is part2 in the attachments. I tried running ctags on part1 and 
had no problem. Am I doing something wrong?
Comment 10 Tomas Lidén CLA 2005-09-01 10:42:33 EDT
I had to upload all the code in two parts, since bugzilla has a limit on 2Mb 
for attachments.

(If you were able to run on part1, that might be another indication on 
something fishy about variant.hh (which is in part2)).
Comment 11 Markus Schorn CLA 2007-06-18 11:05:02 EDT
I do get an StackOverflowError using the FullIndexer in 4.0, the FastIndexer works fine.
I'll try to fix this.
Comment 12 Tomas Lidén CLA 2007-06-19 02:41:22 EDT
That's nice..
But due to this bug and the lack of support for local CVS I gave up on Eclipse and CDT long ago - now using good old Xemacs as the rest of the team..
Comment 13 Markus Schorn CLA 2007-06-19 03:21:42 EDT
Fixed in 4.0 > 20070619.