Community
Participate
Working Groups
I2002015 - create workspace with jdt.ui and required plugins (binary) - exchange jdt.ui with the source version. - close workspace - restart workspace with a maximum heap of 10M - select JavaPlugin - activate Rename, enter new name - press OK The VM trace is: java.lang.OutOfMemoryError <<no stack trace available>> Full thread dump: "Decoration" prio=2 tid=0x59599e8 nid=0x4b0 waiting on monitor [0x63cf000..0x63c fdbc] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:420) at org.eclipse.ui.internal.decorators.DecorationScheduler.next(Decoratio nScheduler.java:247) at org.eclipse.ui.internal.decorators.DecorationScheduler$3.run(Decorati onScheduler.java:273) at java.lang.Thread.run(Thread.java:484) "Signal Dispatcher" daemon prio=10 tid=0x23d938 nid=0x454 waiting on monitor [0. .0] "Finalizer" daemon prio=9 tid=0x7fb890 nid=0x68c waiting on monitor [0x562f000.. 0x562fdbc] at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:108) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:123) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:162) "Reference Handler" daemon prio=10 tid=0x5370368 nid=0x1c4 waiting on monitor [0 x55ef000..0x55efdbc] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:420) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:110) "main" prio=5 tid=0x2348a8 nid=0x67c waiting on monitor [0x6e000..0x6fc34] at java.lang.Thread.sleep(Native Method) at org.eclipse.jdt.internal.core.search.processing.JobManager.performCon currentJob(JobManager.java:247) at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:413 ) at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.s earch(RefactoringSearchEngine.java:133) at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.s earch(RefactoringSearchEngine.java:100) at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.s earch(RefactoringSearchEngine.java:95) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeRefactor ing.getReferences(RenameTypeRefactoring.java:499) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeRefactor ing.checkInput(RenameTypeRefactoring.java:362) at org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationU nitRefactoring.checkInput(RenameCompilationUnitRefactoring.java:305) at org.eclipse.jdt.internal.ui.refactoring.CheckConditionsOperation.run( CheckConditionsOperation.java:59) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run(Cre ateChangeOperation.java:94) at org.eclipse.jdt.internal.ui.refactoring.PerformChangeOperation.run(Pe rformChangeOperation.java:138) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalCont ext.java:296) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.run( RefactoringWizardDialog2.java:256) at org.eclipse.jdt.internal.ui.refactoring.PerformRefactoringUtil.perfor mRefactoring(PerformRefactoringUtil.java:43) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFini sh(RefactoringWizard.java:362) at org.eclipse.jdt.internal.ui.refactoring.UserInputWizardPage.performFi nish(UserInputWizardPage.java:113) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizard.performFini sh(RefactoringWizard.java:425) at org.eclipse.jdt.internal.ui.refactoring.RefactoringWizardDialog2.okPr essed(RefactoringWizardDialog2.java:371) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:240) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:398) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.jface.window.Window.runEventLoop(Window.java:561) at org.eclipse.jface.window.Window.open(Window.java:541) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.ac tivate(RefactoringStarter.java:60) at org.eclipse.jdt.internal.ui.refactoring.RefactoringSupport$AbstractRe nameSupport.rename(RefactoringSupport.java:91) at org.eclipse.jdt.ui.refactoring.RenameSupport.openDialog(RenameSupport .java:98) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementActi on.run(RenameJavaElementAction.java:144) at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementActi on.run(RenameJavaElementAction.java:76) at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:115) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(Select ionDispatchAction.java:191) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispa tchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:804) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:422) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(Act ionContributionItem.java:374) at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContri butionItem.java:368) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handle Event(ActionContributionItem.java:69) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1467) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1450) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) "VM Thread" prio=5 tid=0x53de1c0 nid=0x698 runnable "VM Periodic Task Thread" prio=10 tid=0x23c600 nid=0x1a0 waiting on monitor "Suspend Checker Thread" prio=10 tid=0x23cf88 nid=0x6b8 runnable
Why do you think a maximum heap of 10MB is a valid testcase ?
This was a randomly choosen number. We had a PR that refactoring behaves strange when runing out of memory and I discovered this bug as a side effect. IMO it happens in any case when search runs out of memory.
Feels like we are missing some finally block somewhere to release a lock.
Removing the milestone, good candidate during test pass.
According to the Thread dump, the OutOfMemoryError occured in the 'Java indexing' thread (it is missing). JobManager.run(...) should have a finally block that set activated to false and awaitingJobsCount() should return 0 if not activated.
JobManager.run() already protects itself & tries to restart the indexing thread whenever any RuntimeException is caught. What's a finally block going to do? Also if awaitingJobsCount() answers 0, then performConcurrentJob() will work differently.
An OutOfMemoryError is not a RuntimeException. The idea of the finally block is to empty the queue of jobs so that another thread which is actively waiting for the jobs to finish is not blocked as this bug reports shows.
Just being curious, when trapping RuntimeException, why don't we always rethrow it after having done what's necessary ? In case the thread is null, we will silently absorb it. Feels wrong on the surface.
Added another exception handler (same as the one for RuntimeExceptions) for all Errors (except ThreadDeath). We will now create a new background indexing thread which will start with an empty jobs queue. Any concurrent job waiting on the indexing thread will run but find inconsistent results.
Verified.