Bug 348247 - [spell checking] Spell check takes long when computing proposals for a very long string
Summary: [spell checking] Spell check takes long when computing proposals for a very l...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6.2   Edit
Hardware: All All
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: performance
Depends on:
Blocks:
 
Reported: 2011-06-03 13:10 EDT by Eleanor Joslin CLA
Modified: 2019-12-06 16:22 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eleanor Joslin CLA 2011-06-03 13:10:26 EDT
Build Identifier: M20110210-1200

When spellchecking a very long string (about 1000 characters) Eclipse hangs for 10-20 seconds.

Reproducible: Always

Steps to Reproduce:
1. Enable spell checking in the Eclipse preferences
2. Create an untitled text file
3. Type or paste a long string of "aaaaaaaaaaa" (about 1000 characters)
4. Type a newline.  Eclipse hangs.
Comment 1 Dani Megert CLA 2011-06-03 13:13:28 EDT
(In reply to comment #0)
> Build Identifier: M20110210-1200
> 
> When spellchecking a very long string (about 1000 characters) Eclipse hangs for
> 10-20 seconds.
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Enable spell checking in the Eclipse preferences
> 2. Create an untitled text file
> 3. Type or paste a long string of "aaaaaaaaaaa" (about 1000 characters)
> 4. Type a newline.  Eclipse hangs.

Are you sure it doesn't happen even if spell checking is disabled?

Please create and attach a stack dump. For details see http://wiki.eclipse.org/index.php/How_to_report_a_deadlock.
Comment 2 Deepak Azad CLA 2011-06-03 13:54:18 EDT
Interesting.

When I paste 'qqqqqqqqqqqq...' (>=4095 characters) in the java editor or the text editor I observe 2 things

- The rendering of characters is a bit messed up, sometimes the characters are visible and sometimes not. This is independent of spell check, but when spell check is enabled I see the red squiggly line but no characters, when I scroll horizontally the characters sometime begins to appear. But I guess this is a different bug...

- Now when the spell check is enabled and I hover over the long word or press Ctrl+1 Eclipse gets stuck for a while. After a while it becomes responsive but there is an exception in the error log. Things are fine if I do not invoke quick fix.

-------------------------------------------------------------------------------
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: Java heap space)
	at org.eclipse.swt.SWT.error(SWT.java:4277)
	at org.eclipse.swt.SWT.error(SWT.java:4192)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4138)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3755)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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:344)
	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:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOfRange(Arrays.java:2694)
	at java.lang.String.<init>(String.java:234)
	at java.lang.StringBuffer.toString(StringBuffer.java:561)
	at org.eclipse.jdt.internal.ui.text.spelling.engine.DefaultPhoneticHashProvider.getHash(DefaultPhoneticHashProvider.java:674)
	at org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary.getProposals(AbstractSpellDictionary.java:424)
	at org.eclipse.jdt.internal.ui.text.spelling.engine.DefaultSpellChecker.getProposals(DefaultSpellChecker.java:293)
	at org.eclipse.jdt.internal.ui.text.spelling.WordQuickFixProcessor.getCorrections(WordQuickFixProcessor.java:95)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:378)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:339)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:335)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:468)
	at org.eclipse.jdt.internal.ui.text.java.hover.ProblemHover$ProblemInfo.getJavaAnnotationFixes(ProblemHover.java:224)
	at org.eclipse.jdt.internal.ui.text.java.hover.ProblemHover$ProblemInfo.getCompletionProposals(ProblemHover.java:198)
	at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.deferredCreateContent(AbstractAnnotationHover.java:284)
	at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.setInput(AbstractAnnotationHover.java:186)
	at org.eclipse.jface.text.AbstractInformationControlManager.internalShowInformationControl(AbstractInformationControlManager.java:1181)
	at org.eclipse.jface.text.AbstractInformationControlManager.presentInformation(AbstractInformationControlManager.java:1150)
	at org.eclipse.jface.text.AbstractHoverInformationControlManager.presentInformation(AbstractHoverInformationControlManager.java:902)
	at org.eclipse.jface.text.TextViewerHoverManager.doPresentInformation(TextViewerHoverManager.java:243)
	at org.eclipse.jface.text.TextViewerHoverManager$5.run(TextViewerHoverManager.java:233)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4138)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3755)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
-------------------------------------------------------------------------------
Comment 3 Dani Megert CLA 2011-06-03 13:55:48 EDT
There are general platform dependent issues with long lines. For those we already have SWT bugs.
Comment 4 Deepak Azad CLA 2011-06-03 13:58:22 EDT
(In reply to comment #0)
> Build Identifier: M20110210-1200
> 
> When spellchecking a very long string (about 1000 characters) Eclipse hangs for
> 10-20 seconds.
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Enable spell checking in the Eclipse preferences
> 2. Create an untitled text file
> 3. Type or paste a long string of "aaaaaaaaaaa" (about 1000 characters)
> 4. Type a newline.  Eclipse hangs.

- Can you be a bit more precise about the length of the word ? 
- Do you hover over the long word or press Ctrl+1 ? 
- Do you see any exceptions in the error log once eclipse comes out of the hang
state after 10-20 seconds?
Comment 5 Dani Megert CLA 2011-06-06 02:41:57 EDT
>- Now when the spell check is enabled and I hover over the long word or press
>Ctrl+1 Eclipse gets stuck for a while. After a while it becomes responsive but
>there is an exception in the error log. 
Can you reproduce the OOME? If so, please file a separate bug.
Comment 6 Chris Simmons CLA 2011-06-06 05:30:00 EDT
Its not a deadlock its just munching CPU.  I can get it to hang by either hovering long enough or hitting ctrl+1.

It seems to depend on the text too.  Provoking the spell-check suggestions either way:-

200 a's takes a couple of seconds on my box (3GHz).
400 a's takes 28 seconds.

I think its something pathological in the spell checker as disabling spell check fixes the problem and 400 random alphabetic characters (i.e. mash the keyboard) doesn't exhibit anywhere near such a long delay.

The exception in comment 2 was out of heap space so it doesn't tell us much except that it also eats lots of heap.
Comment 7 Dani Megert CLA 2011-06-06 05:37:08 EDT
> 200 a's takes a couple of seconds on my box (3GHz).
> 400 a's takes 28 seconds.
I can't reproduce this on my machine. It is instantaneous.

>Its not a deadlock its just munching CPU.
You can still use the link provided in comment 1 to learn how to create a stack trace and attach it here.
Comment 8 Chris Simmons CLA 2011-06-06 06:13:40 EDT
(In reply to comment #7)
> You can still use the link provided in comment 1 to learn how to create a stack
> trace and attach it here.

Here's the main thread's stack trace, all the other threads are just waiting.  I actually did this writing a java comment rather than in a text file, not sure that's relevant though?

"main" prio=10 tid=0x085f7c00 nid=0x3810 runnable [0xfff58000]
   java.lang.Thread.State: RUNNABLE
	at org.eclipse.jdt.internal.ui.text.spelling.engine.DefaultPhoneticDistanceAlgorithm.getDistance(DefaultPhoneticDistanceAlgorithm.java:50)
	at org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary.getCandidates(AbstractSpellDictionary.java:229)
	at org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary.getProposals(AbstractSpellDictionary.java:448)
	at org.eclipse.jdt.internal.ui.text.spelling.engine.DefaultSpellChecker.getProposals(DefaultSpellChecker.java:293)
	at org.eclipse.jdt.internal.ui.text.spelling.WordQuickFixProcessor.getCorrections(WordQuickFixProcessor.java:95)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:374)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:336)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:332)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:461)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectProposals(JavaCorrectionProcessor.java:277)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.computeQuickAssistProposals(JavaCorrectionProcessor.java:239)
	at org.eclipse.jface.text.quickassist.QuickAssistAssistant$ContentAssistProcessor.computeCompletionProposals(QuickAssistAssistant.java:73)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1834)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
	at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660)
	at org.eclipse.jface.text.quickassist.QuickAssistAssistant.showPossibleQuickAssists(QuickAssistAssistant.java:126)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.showPossibleQuickAssists(JavaCorrectionAssistant.java:190)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:194)
	at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.texteditor.TextOperationAction.run(TextOperationAction.java:129)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	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.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1257)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2841)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4796)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4360)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8168)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1238)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2229)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3159)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	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)
Comment 9 Deepak Azad CLA 2011-06-06 06:55:01 EDT
(In reply to comment #6)
> Its not a deadlock its just munching CPU.  I can get it to hang by either
> hovering long enough or hitting ctrl+1.
Ok, it is in the quick fix code. The stack trace confirms it.

I will take a look.
Comment 10 Eclipse Genie CLA 2019-12-06 16:22:17 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.