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

Bug 320157

Summary: Indexer runs forever
Product: [Tools] CDT Reporter: Igor Kuralenok <solar>
Component: cdt-indexerAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: critical    
Priority: P3 CC: yevshif
Version: 7.0   
Target Milestone: 7.0.1   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix mschorn.eclipse: iplog-

Description Igor Kuralenok CLA 2010-07-17 05:16:12 EDT
Build Identifier: 201006141710

100% CPU usage. Looks like a infinite loop in preprocessor. Stack trace:

Full thread dump Java HotSpot(TM) Client VM (16.3-b01-279 mixed mode):

"[ThreadPool Manager] - Idle Thread" daemon prio=5 tid=000000001429a400 nid=0xb1d38000 in Object.wait() [00000000b1d37000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001ba8a098> (a org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor)
	at java.lang.Object.wait(Object.java:485)
	at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:106)
	- locked <000000001ba8a098> (a org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor)

"SVN Kit 1.2 Connector" prio=5 tid=000000001422bc00 nid=0xb1e3a000 in Object.wait() [00000000b1e39000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001b05c520> (a java.util.ArrayList)
	at java.lang.Object.wait(Object.java:485)
	at org.polarion.team.svn.connector.svnkit.SVNKitConnector$ProgressMonitorThread.run(SVNKitConnector.java:1605)
	- locked <000000001b05c520> (a java.util.ArrayList)

"Bundle File Closer" daemon prio=5 tid=000000001415b400 nid=0xb1c36000 in Object.wait() [00000000b1c35000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001ad27b90> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at java.lang.Object.wait(Object.java:485)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:397)
	- locked <000000001ad27b90> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:333)

"Worker-6" prio=5 tid=000000001317cc00 nid=0xb1b34000 in Object.wait() [00000000b1b33000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:217)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

"Worker-5" prio=5 tid=000000001317c000 nid=0xb1a32000 in Object.wait() [00000000b1a31000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:217)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

"Worker-4" prio=5 tid=000000001317b400 nid=0xb1930000 in Object.wait() [00000000b192f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:217)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

"Worker-3" prio=5 tid=00000000140b4c00 nid=0xb182e000 in Object.wait() [00000000b182d000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:217)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

"Worker-2" prio=5 tid=000000001317ac00 nid=0xb172c000 runnable [00000000b172b000]
   java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.FileDispatcher.read0(Native Method)
	at sun.nio.ch.FileDispatcher.read(FileDispatcher.java:26)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
	at sun.nio.ch.IOUtil.read(IOUtil.java:206)
	at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:144)
	- locked <000000001c709070> (a java.lang.Object)
	at org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.readChunkData(FileCharArray.java:126)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.createChunk(LazyCharArray.java:145)
	at org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.createChunk(FileCharArray.java:101)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.getChunk(LazyCharArray.java:132)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.getChunkData(LazyCharArray.java:113)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.readUpTo(LazyCharArray.java:88)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.isValidOffset(LazyCharArray.java:65)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.isValidOffset(Lexer.java:114)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.nextCharPhase3(Lexer.java:1018)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.fetchToken(Lexer.java:343)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.nextToken(Lexer.java:171)
	at org.eclipse.cdt.internal.core.parser.scanner.ScannerContext.nextPPToken(ScannerContext.java:246)
	at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.internalFetchToken(CPreprocessor.java:734)
	at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.fetchToken(CPreprocessor.java:469)
	at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.nextToken(CPreprocessor.java:563)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.fetchToken(AbstractGNUSourceCodeParser.java:260)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.nextToken(AbstractGNUSourceCodeParser.java:284)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.lookaheadToken(AbstractGNUSourceCodeParser.java:294)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.LA(AbstractGNUSourceCodeParser.java:317)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.LT(AbstractGNUSourceCodeParser.java:444)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.skipToSemiOrClosingBrace(AbstractGNUSourceCodeParser.java:734)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.skipProblemDeclaration(AbstractGNUSourceCodeParser.java:707)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.problemDeclaration(AbstractGNUSourceCodeParser.java:1697)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.declarationList(AbstractGNUSourceCodeParser.java:1321)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parseTranslationUnit(AbstractGNUSourceCodeParser.java:1253)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.translationUnit(AbstractGNUSourceCodeParser.java:1248)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parse(AbstractGNUSourceCodeParser.java:645)
	at org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage.getASTTranslationUnit(AbstractCLikeLanguage.java:143)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.createAST(AbstractIndexerTask.java:286)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.createAST(AbstractIndexerTask.java:259)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:753)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:636)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:345)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:127)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask.run(PDOMRebuildTask.java:84)
	at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:137)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

"Worker-1" prio=5 tid=00000000141d9400 nid=0xb162a000 in Object.wait() [00000000b1629000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:185)
	- locked <000000001897e928> (a org.eclipse.core.internal.jobs.WorkerPool)
	at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:217)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:50)

"Worker-0" prio=5 tid=000000001409b400 nid=0xb1324000 waiting on condition [00000000b1323000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob$ProgressUpdateJob.run(PDOMIndexerJob.java:46)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

"Worker-JM" prio=5 tid=000000001405f800 nid=0xb1528000 in Object.wait() [00000000b1527000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001895cf58> (a java.util.ArrayList)
	at org.eclipse.core.internal.jobs.InternalWorker.run(InternalWorker.java:58)
	- locked <000000001895cf58> (a java.util.ArrayList)

"[Timer] - Main Queue Handler" daemon prio=5 tid=000000001317e800 nid=0xb1426000 in Object.wait() [00000000b1425000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0000000018952c38> (a java.lang.Object)
	at org.eclipse.equinox.internal.util.impl.tpt.timer.TimerImpl.run(TimerImpl.java:141)
	- locked <0000000018952c38> (a java.lang.Object)
	at java.lang.Thread.run(Thread.java:637)

"Framework Event Dispatcher" daemon prio=5 tid=0000000014050800 nid=0xb1222000 in Object.wait() [00000000b1221000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <00000000189495a8> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at java.lang.Object.wait(Object.java:485)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:397)
	- locked <00000000189495a8> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:333)

"Start Level Event Dispatcher" daemon prio=5 tid=0000000013137400 nid=0xb1120000 in Object.wait() [00000000b111f000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <000000001895c1c0> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at java.lang.Object.wait(Object.java:485)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:397)
	- locked <000000001895c1c0> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:333)

"State Data Manager" daemon prio=5 tid=000000001404f000 nid=0xb0f28000 waiting on condition [00000000b0f27000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at org.eclipse.osgi.internal.baseadaptor.StateManager.run(StateManager.java:319)
	at java.lang.Thread.run(Thread.java:637)

"Poller SunPKCS11-Darwin" daemon prio=1 tid=0000000014033800 nid=0xb0e1d000 waiting on condition [00000000b0e1c000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep(Native Method)
	at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:692)
	at java.lang.Thread.run(Thread.java:637)

"Low Memory Detector" daemon prio=5 tid=00000000130b4c00 nid=0xb0c19000 runnable [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"CompilerThread0" daemon prio=9 tid=00000000130b3c00 nid=0xb0b17000 waiting on condition [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=9 tid=00000000130b3000 nid=0xb0a15000 waiting on condition [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Surrogate Locker Thread (CMS)" daemon prio=5 tid=00000000130b2000 nid=0xb0913000 waiting on condition [0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=00000000130a2400 nid=0xb0811000 in Object.wait() [00000000b0810000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0000000018810020> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
	- locked <0000000018810020> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=00000000130a1800 nid=0xb070f000 in Object.wait() [00000000b070e000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <00000000188116a8> (a java.lang.ref.Reference$Lock)
	at java.lang.Object.wait(Object.java:485)
	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
	- locked <00000000188116a8> (a java.lang.ref.Reference$Lock)

"main" prio=6 tid=0000000013000800 nid=0xa0763500 runnable [00000000bfffc000]
   java.lang.Thread.State: RUNNABLE
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend_bool(Native Method)
	at org.eclipse.swt.internal.cocoa.NSRunLoop.runMode(NSRunLoop.java:42)
	at org.eclipse.swt.widgets.Display.sleep(Display.java:4193)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:826)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.dialogs.AboutDialog$5.widgetSelected(AboutDialog.java:467)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3776)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1187)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3622)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3277)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.about.AboutHandler.execute(AboutHandler.java:32)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:171)
	at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.runAction(CocoaUIEnhancer.java:416)
	at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.aboutMenuItemSelected(CocoaUIEnhancer.java:520)
	at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.actionProc(CocoaUIEnhancer.java:540)
	at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.actionProc(CocoaUIEnhancer.java:524)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:4483)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4739)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:85)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3271)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

"VM Thread" prio=9 tid=00000000130a0c00 nid=0xb060d000 runnable 

"Gang worker#0 (Parallel GC Threads)" prio=9 tid=0000000013002800 nid=0xb0307000 runnable 

"Gang worker#1 (Parallel GC Threads)" prio=9 tid=0000000013003400 nid=0xb0409000 runnable 

"Concurrent Mark-Sweep GC Thread" prio=9 tid=0000000013068800 nid=0xb050b000 runnable 
"VM Periodic Task Thread" prio=10 tid=00000000130b6400 nid=0xb0d1b000 waiting on condition 

"Exception Catcher Thread" prio=10 tid=0000000013001400 nid=0xb0205000 runnable 
JNI global references: 2007

Heap
 par new generation   total 14784K, used 2219K [0000000016810000, 0000000017810000, 0000000018810000)
  eden space 13184K,  13% used [0000000016810000, 00000000169c8b58, 00000000174f0000)
  from space 1600K,  28% used [0000000017680000, 00000000176f2450, 0000000017810000)
  to   space 1600K,   0% used [00000000174f0000, 00000000174f0000, 0000000017680000)
 concurrent mark-sweep generation total 203300K, used 139643K [0000000018810000, 0000000024e99000, 0000000047810000)
 concurrent-mark-sweep perm gen total 76692K, used 46781K [0000000047810000, 000000004c2f5000, 0000000057810000)


Reproducible: Always

Steps to Reproduce:
1. Run on our company sources (unfortunately they are not open).
2.
3.
Comment 1 Markus Schorn CLA 2010-07-20 07:10:37 EDT
I don't see an indication for an infinite loop, the parser is trying to read more characters from the input stream.
Comment 2 Igor Kuralenok CLA 2010-07-20 14:47:33 EDT
It's clear that it is not a simple infinite loop, but looks like infinite preprocessor interpretation or something. I've let it go for night but still the same stack trace.
Comment 3 Markus Schorn CLA 2010-07-21 03:28:51 EDT
I don't think that the preprocessor is causing the loop (it requests a new token, which means some sort of progress), maybe there is a loop within 
org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.isValidOffset(...),
however I cannot see a bug by reviewing the code. Can you run the application in a debugger to see whether this method ever returns?
Also it'd be good to know whether the stack-trace on the next day is exactly the same. If you open the Progress View, does it report the same file on the next day?
Comment 4 Igor Kuralenok CLA 2010-07-21 06:01:55 EDT
(In reply to comment #3)
> Can you run the application
> in a debugger to see whether this method ever returns?
I'm sorry but I need to get into CDT development first, but right now I have no time for this (few days to vacation :)).

> Also it'd be good to know whether the stack-trace on the next day is exactly
> the same. If you open the Progress View, does it report the same file on the
> next day?

Yes the file is the same. Trace is as follows (~36 hours after start). My blind/wild guess (as former IDEA team member :)) is that during preprocessor stage you bump into situation when result of preprocessor stage need to be processed again (like abc -> bca -> abc->etc. with two #defines for abc and bca). It is based on 2 observations:
-- no memory is consumed during this process;
-- most of process time is system time (io operations).

java.lang.Thread.State: RUNNABLE
	at sun.nio.ch.FileDispatcher.read0(Native Method)
	at sun.nio.ch.FileDispatcher.read(FileDispatcher.java:26)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
	at sun.nio.ch.IOUtil.read(IOUtil.java:206)
	at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:144)
	- locked <000000001ef07938> (a java.lang.Object)
	at org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.readChunkData(FileCharArray.java:126)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.createChunk(LazyCharArray.java:145)
	at org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.createChunk(FileCharArray.java:101)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.getChunk(LazyCharArray.java:132)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.getChunkData(LazyCharArray.java:113)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.readUpTo(LazyCharArray.java:88)
	at org.eclipse.cdt.internal.core.parser.scanner.LazyCharArray.isValidOffset(LazyCharArray.java:65)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.isValidOffset(Lexer.java:114)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.nextCharPhase3(Lexer.java:1018)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.fetchToken(Lexer.java:343)
	at org.eclipse.cdt.internal.core.parser.scanner.Lexer.nextToken(Lexer.java:171)
	at org.eclipse.cdt.internal.core.parser.scanner.ScannerContext.nextPPToken(ScannerContext.java:246)
	at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.internalFetchToken(CPreprocessor.java:734)
	at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.fetchToken(CPreprocessor.java:469)
	at org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor.nextToken(CPreprocessor.java:563)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.fetchToken(AbstractGNUSourceCodeParser.java:260)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.nextToken(AbstractGNUSourceCodeParser.java:284)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.lookaheadToken(AbstractGNUSourceCodeParser.java:294)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.LA(AbstractGNUSourceCodeParser.java:317)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.LT(AbstractGNUSourceCodeParser.java:444)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.skipToSemiOrClosingBrace(AbstractGNUSourceCodeParser.java:734)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.skipProblemDeclaration(AbstractGNUSourceCodeParser.java:707)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.problemDeclaration(AbstractGNUSourceCodeParser.java:1697)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.declarationList(AbstractGNUSourceCodeParser.java:1321)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parseTranslationUnit(AbstractGNUSourceCodeParser.java:1253)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.translationUnit(AbstractGNUSourceCodeParser.java:1248)
	at org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.parse(AbstractGNUSourceCodeParser.java:645)
	at org.eclipse.cdt.core.dom.parser.AbstractCLikeLanguage.getASTTranslationUnit(AbstractCLikeLanguage.java:143)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.createAST(AbstractIndexerTask.java:286)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.createAST(AbstractIndexerTask.java:259)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseFile(AbstractIndexerTask.java:753)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.parseLinkage(AbstractIndexerTask.java:636)
	at org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask.runTask(AbstractIndexerTask.java:345)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMIndexerTask.run(PDOMIndexerTask.java:127)
	at org.eclipse.cdt.internal.core.pdom.indexer.PDOMRebuildTask.run(PDOMRebuildTask.java:84)
	at org.eclipse.cdt.internal.core.pdom.PDOMIndexerJob.run(PDOMIndexerJob.java:137)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 5 Igor Kuralenok CLA 2010-08-23 09:40:49 EDT
It looks I've found the problem.
org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.readChunkData
does not take into account result of decoder operation. It must break the loop in case of decoder result is "overflow" but not to wait until dest buffer is full.
here is my variant of loop (not optimal but with minimum of changes):
		while (dest.position() < CHUNK_SIZE && !endOfInput) {
			fChannel.position(fileOffset);
			in.clear();
			int count= fChannel.read(in);
			if (count == -1) {
				break;
			}
			
			endOfInput= count < in.capacity();
			in.flip();
			if (fileOffset == 0) {
				skipUTF8ByteOrderMark(in, fCharSet);
			}
			final CoderResult decodeRC = decoder.decode(in, dest, endOfInput);
			fileOffset += in.position();
			if (decodeRC.isOverflow())
				break;
		}
This might be OSX specific trouble.
IK
Comment 6 Markus Schorn CLA 2010-08-23 09:58:06 EDT
(In reply to comment #5)
> It looks I've found the problem.
> org.eclipse.cdt.internal.core.parser.scanner.FileCharArray.readChunkData
> does not take into account result of decoder operation. It must break the loop
> in case of decoder result is "overflow" but not to wait until dest buffer is
> full.
> here is my variant of loop (not optimal but with minimum of changes):
>         while (dest.position() < CHUNK_SIZE && !endOfInput) {
>             fChannel.position(fileOffset);
>             in.clear();
>             int count= fChannel.read(in);
>             if (count == -1) {
>                 break;
>             }
>             endOfInput= count < in.capacity();
>             in.flip();
>             if (fileOffset == 0) {
>                 skipUTF8ByteOrderMark(in, fCharSet);
>             }
>             final CoderResult decodeRC = decoder.decode(in, dest, endOfInput);
>             fileOffset += in.position();
>             if (decodeRC.isOverflow())
>                 break;
>         }
> This might be OSX specific trouble.
> IK

Thanks for diving into this. To me this looks like a bug in the JVM: When the overflow occurs I would expect 'dest.position()' to equal 'CHUNK_SIZE' which 
is the limit of the output buffer. There is two possibilities for how the JVM is wrong:
(a) it does not decode as many characters as possible and therefore the destination buffer's position is not set to the end, or
(b) it does fill the destination buffer and simply fails to adjust its position.

Because it is unclear what happens, there is no clean way to recover from this situation, just breaking the loop will create an array of chars that is not long enough.
Comment 7 Igor Kuralenok CLA 2010-08-23 10:13:22 EDT
Well, I can not find your variant of contract in docs (http://developer.apple.com/mac/library/documentation/Java/Reference/JavaSE6_API/api/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer,%20java.nio.CharBuffer,%20boolean)). What I've found is that it returns CoderResult which is the only indicator of what is going on. Not a word on buffer remaining and other stuff. So JRE is correct, the problem is in interpretation of contract which is wrong. Please fix this.
Comment 8 Markus Schorn CLA 2010-08-23 11:49:23 EDT
(In reply to comment #7)
> Well, I can not find your variant of contract in docs
> (http://developer.apple.com/mac/library/documentation/Java/Reference/JavaSE6_API/api/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer,%20java.nio.CharBuffer,%20boolean)).
> What I've found is that it returns CoderResult which is the only indicator of
> what is going on. Not a word on buffer remaining and other stuff. So JRE is
> correct, the problem is in interpretation of contract which is wrong. Please
> fix this.

Hmm, the contract says (among other things):
... The buffers' positions will be advanced to reflect the bytes read and the characters written, but their marks and limits will not be modified. 

So when an overflow situation occurs I should be safe to assume that the output buffers postition is set to its limit. In any way I don't know how I should interpret a different buffer position? Your JVM somehow says that there is no more room in the output buffer and at the same time it indicates that it is only partially filled. Which of the two is true, i.e. is the position not set correctly or is the buffer not filled? 

If the former is the case I could fix it by adjusting the position, in the latter case I'd need to fill the rest of the buffer, which is unclear to me how that could work (by providing less input??).
Comment 9 Igor Kuralenok CLA 2010-08-24 00:53:17 EDT
Looks like bugzilla don't attach reply letters to comments.

(In reply to comment #8)
> Hmm, the contract says (among other things):
> ... The buffers' positions will be advanced to reflect the bytes read and the
> characters written, but their marks and limits will not be modified. 
Not a word on overflow situation. Limits are modified correctly. Last char is not filled.
 
> So when an overflow situation occurs I should be safe to assume that the output
> buffers postition is set to its limit. In any way I don't know how I should
> interpret a different buffer position? Your JVM somehow says that there is no
> more room in the output buffer and at the same time it indicates that it is
> only partially filled. Which of the two is true, i.e. is the position not set
> correctly or is the buffer not filled? 
Well. You set endOfStream argument to false. I believe 32-bit or 64-bit optimized version of decoder won't
convert last char in this situation, expecting next chunk to come. I don't see any bugs here. It works according to spec, but not according expectations :).
 
> If the former is the case I could fix it by adjusting the position, in the
> latter case I'd need to fill the rest of the buffer, which is unclear to me how
> that could work (by providing less input??).
Anyway you work this around will be way better then infinite loop with CPU/disk load of 100%.
Comment 10 Markus Schorn CLA 2010-08-24 03:13:53 EDT
(In reply to comment #9)
> Not a word on overflow situation. Limits are modified correctly. Last char is
> not filled.
I did not make that up, Java 1.5 documentation says: 
    CoderResult.OVERFLOW indicates that the output buffer is full. This method
    should be invoked again with a non-full output buffer. 

Looking at the 1.6 documentation I can see that they have changed the contract :-(:
   CoderResult.OVERFLOW indicates that there is insufficient space in the 
   output buffer to decode any more bytes. This method should be invoked again 
   with an output buffer that has more remaining characters.

> Well. You set endOfStream argument to false. I believe 32-bit or 64-bit
> optimized version of decoder won't
> convert last char in this situation, expecting next chunk to come. 
Setting the endOfStream argument will not help, it has an effect when there are
no more input bytes, however in our situation there is sufficient input.

> ...
> Anyway you work this around will be way better then infinite loop with
> CPU/disk load of 100%.
I am looking for a more complete solution for the problem. Because I don't see a way to fill the buffer (with knowing the file-position afterwards) I will need to change the way FileCharArray works.

Thanks for your help in figuring out why the infinite loop occurs.
Comment 11 Igor Kuralenok CLA 2010-08-24 04:04:39 EDT
(In reply to comment #10)
> Setting the endOfStream argument will not help, it has an effect when there are
> no more input bytes, however in our situation there is sufficient input.
I was hoping that it works like flush. But you are right, this does not help. 
 
> > ...
> > Anyway you work this around will be way better then infinite loop with
> > CPU/disk load of 100%.
> I am looking for a more complete solution for the problem. Because I don't see
> a way to fill the buffer (with knowing the file-position afterwards) I will
> need to change the way FileCharArray works.
I'd suggest increasing dest buffer instead as quick fix. I've just checked that this fixes my trouble (final CharBuffer dest= CharBuffer.allocate(CHUNK_SIZE + 10);).
Comment 12 Markus Schorn CLA 2010-08-24 05:21:32 EDT
(In reply to comment #11)
> I'd suggest increasing dest buffer instead as quick fix. I've just checked that
> this fixes my trouble (final CharBuffer dest= CharBuffer.allocate(CHUNK_SIZE +
> 10);).

.. and will lead to other problems. I will work on a complete fix.
Comment 13 Markus Schorn CLA 2010-08-25 05:29:39 EDT
Created attachment 177398 [details]
fix

Attached is my proposal for the fix. Because I was not able to reproduce the issue on my Windows machine, it'd be helpful if you can test the patch on your mac.
Comment 14 Markus Schorn CLA 2010-08-25 07:38:33 EDT
Fixed in 7.0.1 and 8.0 > 20100825.
Comment 15 CDT Genie CLA 2010-08-25 10:23:05 EDT
*** cdt cvs genie on behalf of mschorn ***
Bug 320157: Endless loop decoding large file.

[*] LazyCharArray.java 1.4.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LazyCharArray.java?root=Tools_Project&r1=1.4&r2=1.4.2.1
[*] FileCharArray.java 1.4.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/FileCharArray.java?root=Tools_Project&r1=1.4&r2=1.4.2.1

[*] ScannerTestSuite.java 1.9.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/ScannerTestSuite.java?root=Tools_Project&r1=1.9&r2=1.9.2.1
[+] FileCharArrayTests.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/FileCharArrayTests.java?root=Tools_Project&revision=1.1&view=markup

[*] ScannerTestSuite.java 1.10 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/ScannerTestSuite.java?root=Tools_Project&r1=1.9&r2=1.10
[+] FileCharArrayTests.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/scanner/FileCharArrayTests.java?root=Tools_Project&revision=1.1&view=markup

[*] LazyCharArray.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LazyCharArray.java?root=Tools_Project&r1=1.5&r2=1.6
[*] FileCharArray.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/FileCharArray.java?root=Tools_Project&r1=1.4&r2=1.5