This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 130352 [details] thread dump I was invoking "Undo" quite many times in a row, via keyboard. Not sure about proper component, please evaluate. Thanks a lot. Product Version: NetBeans IDE Dev (Build 20130110-f9c322a6c6f2) Java: 1.6.0_38; Java HotSpot(TM) 64-Bit Server VM 20.13-b02 Runtime: Java(TM) SE Runtime Environment 1.6.0_38-b05 System: Linux version 3.5.0-22-generic running on amd64; UTF-8; cs_CZ (nb)
What I can infer from the thread dump: BaseDocument.find is in the "search backwards" mode, while the finder passed to it is a forward finder. This seems to cause an infinite loop in BaseDocument.find (not really surprising and there is probably not much that could be fixed on this layer - or more precisely, the results would not be correct anyway, even if the infinite loop would be stopped). So the question is why the backwards search mode. The backwards mode is used if the search-limit < search-start. getRowFirstNonWhite basically does: Element lineElement = <given-line> find(..., lineElement.getStartOffset(), lineElement.getEndOffset() - 1) // ==search-start== , ==search-limit== So, it seems that: lineElement.getEndOffset() - 1 < lineElement.getStartOffset() which should not happen, as far as I can tell. So the only thing that comes to my mind is that start/end Positions got messed up during an undo or redo (a redo is being run on the thread dump, BTW). It might (but needn't) be related to bug #225087.
Several consecutive thread dumps when this happened to me: java.lang.Thread.State: RUNNABLE at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.getChars(EditorDocumentContent.java:225) - locked <0x000000012ce396d8> (a org.netbeans.modules.editor.lib2.document.EditorDocumentContent) at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:812) at org.netbeans.editor.BaseDocument.find(BaseDocument.java:1248) at org.netbeans.editor.Utilities.getFirstNonWhiteFwd(Utilities.java:497) at org.netbeans.editor.Utilities.getRowFirstNonWhite(Utilities.java:228) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:822) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:815) at org.netbeans.modules.editor.hints.AnnotationHolder.setErrorDescriptionsImpl(AnnotationHolder.java:1106) - locked <0x000000012ce4af40> (a org.netbeans.modules.editor.hints.AnnotationHolder) at org.netbeans.modules.editor.hints.AnnotationHolder.access$1900(AnnotationHolder.java:123) java.lang.Thread.State: RUNNABLE at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:812) at org.netbeans.editor.BaseDocument.find(BaseDocument.java:1248) at org.netbeans.editor.Utilities.getFirstNonWhiteFwd(Utilities.java:497) at org.netbeans.editor.Utilities.getRowFirstNonWhite(Utilities.java:228) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:822) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:815) at org.netbeans.modules.editor.hints.AnnotationHolder.setErrorDescriptionsImpl(AnnotationHolder.java:1106) - locked <0x000000012ce4af40> (a org.netbeans.modules.editor.hints.AnnotationHolder) at org.netbeans.modules.editor.hints.AnnotationHolder.access$1900(AnnotationHolder.java:123) java.lang.Thread.State: RUNNABLE at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:812) at org.netbeans.editor.BaseDocument.find(BaseDocument.java:1248) at org.netbeans.editor.Utilities.getFirstNonWhiteFwd(Utilities.java:497) at org.netbeans.editor.Utilities.getRowFirstNonWhite(Utilities.java:228) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:822) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:815) at org.netbeans.modules.editor.hints.AnnotationHolder.setErrorDescriptionsImpl(AnnotationHolder.java:1106) - locked <0x000000012ce4af40> (a org.netbeans.modules.editor.hints.AnnotationHolder) at org.netbeans.modules.editor.hints.AnnotationHolder.access$1900(AnnotationHolder.java:123) java.lang.Thread.State: RUNNABLE at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:812) at org.netbeans.editor.BaseDocument.find(BaseDocument.java:1248) at org.netbeans.editor.Utilities.getFirstNonWhiteFwd(Utilities.java:497) at org.netbeans.editor.Utilities.getRowFirstNonWhite(Utilities.java:228) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:822) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:815) at org.netbeans.modules.editor.hints.AnnotationHolder.setErrorDescriptionsImpl(AnnotationHolder.java:1106) - locked <0x000000012ce4af40> (a org.netbeans.modules.editor.hints.AnnotationHolder) at org.netbeans.modules.editor.hints.AnnotationHolder.access$1900(AnnotationHolder.java:123) java.lang.Thread.State: RUNNABLE at org.netbeans.editor.BaseDocument.find(BaseDocument.java:1255) at org.netbeans.editor.Utilities.getFirstNonWhiteFwd(Utilities.java:497) at org.netbeans.editor.Utilities.getRowFirstNonWhite(Utilities.java:228) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:822) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:815) at org.netbeans.modules.editor.hints.AnnotationHolder.setErrorDescriptionsImpl(AnnotationHolder.java:1106) - locked <0x000000012ce4af40> (a org.netbeans.modules.editor.hints.AnnotationHolder) at org.netbeans.modules.editor.hints.AnnotationHolder.access$1900(AnnotationHolder.java:123) java.lang.Thread.State: RUNNABLE at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.getChars(EditorDocumentContent.java:225) - locked <0x000000012ce396d8> (a org.netbeans.modules.editor.lib2.document.EditorDocumentContent) at javax.swing.text.AbstractDocument.getText(AbstractDocument.java:812) at org.netbeans.editor.BaseDocument.find(BaseDocument.java:1248) at org.netbeans.editor.Utilities.getFirstNonWhiteFwd(Utilities.java:497) at org.netbeans.editor.Utilities.getRowFirstNonWhite(Utilities.java:228) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:822) at org.netbeans.modules.editor.hints.AnnotationHolder.updateHighlightsOnLine(AnnotationHolder.java:815) at org.netbeans.modules.editor.hints.AnnotationHolder.setErrorDescriptionsImpl(AnnotationHolder.java:1106) - locked <0x000000012ce4af40> (a org.netbeans.modules.editor.hints.AnnotationHolder) at org.netbeans.modules.editor.hints.AnnotationHolder.access$1900(AnnotationHolder.java:123)
I was also thinking about a possibility that the Positions would not be updated yet when insertUpdate was invoked, but from the David's stack traces it seems it happened outside any document modification (is that correct?).
Tomas, David, any chance you would be running with assertions disabled? I have found a bug related to disabled assertions: http://netbeans.org/bugzilla/show_bug.cgi?id=225133 This is thrown during an undo, and the editor is not in a good shape after that. I was not able to reproduce the infinite loop, but I would not be surprised if it would be caused by that exception. BTW, if running with assertions disabled, could you please check messages.log for exceptions? Thanks.
I think I have assertions disabled (-J-da).
I am getting this exception: SEVERE [global] java.lang.IndexOutOfBoundsException: (offset=237 + length=1)=238 > length()=141 at org.netbeans.modules.editor.lib2.document.CharContent.removeText(CharContent.java:141) at org.netbeans.modules.editor.lib2.document.EditorDocumentContent.removeEdit(EditorDocumentContent.java:172) at org.netbeans.modules.editor.lib2.document.ContentEdit$InsertEdit.undo(ContentEdit.java:215) at org.netbeans.editor.BaseDocumentEvent.undo(BaseDocumentEvent.java:281) at org.netbeans.editor.GuardedDocumentEvent.undo(GuardedDocumentEvent.java:72) at org.netbeans.modules.editor.lib2.document.StableCompoundEdit.undo(StableCompoundEdit.java:93) at org.netbeans.editor.BaseDocument$AtomicCompoundEdit.undo(BaseDocument.java:2179) at org.openide.text.StableCompoundEdit.undo(StableCompoundEdit.java:93) at org.openide.text.WrapUndoEdit.undo(WrapUndoEdit.java:93) at org.openide.awt.UndoRedo$Manager.undoTo(UndoRedo.java:230) at org.openide.awt.UndoRedo$Manager.undo(UndoRedo.java:200) at org.openide.text.UndoRedoManager.access$301(UndoRedoManager.java:98) at org.openide.text.UndoRedoManager$DocLockedRun.run(UndoRedoManager.java:658) at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:317) at org.openide.text.UndoRedoManager$DocLockedRun.<init>(UndoRedoManager.java:631) at org.openide.text.UndoRedoManager$DocLockedRun.<init>(UndoRedoManager.java:623) at org.openide.text.UndoRedoManager$DocLockedRun.<init>(UndoRedoManager.java:619) at org.openide.text.UndoRedoManager.undo(UndoRedoManager.java:437) at org.netbeans.core.multiview.MultiViewPeer$DelegateUndoRedo.undo(MultiViewPeer.java:822) at org.openide.actions.UndoAction.performAction(UndoAction.java:186) at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:129) BUT I think that when this exception happens the infinite loop does not happen! ;-)
And BTW I am able to reproduce (both the exception and the hang) ... At least I think I am able to reproduce ...
I happened to me as well, when trying to reproduce issue 225087. System Info: Product Version = NetBeans IDE Dev (Build 20130121-35c327d5a6d6) (#35c327d5a6d6) Operating System = Windows 7 version 6.1 running on amd64 Java; VM; Vendor = 1.7.0_11; Java HotSpot(TM) 64-Bit Server VM 23.6-b04; Oracle Corporation Runtime = Java(TM) SE Runtime Environment 1.7.0_11-b21 Java Home = C:\PROGRA~1\Java\JDK17~2.0_1\jre System Locale; Encoding = en_US (nb); Cp1250 Home Directory = C:\Users\jprox Current Directory = D:\nbsrc\jet-main\nbbuild\netbeans\bin User Directory = C:\Users\jprox\AppData\Roaming\NetBeans\dev Cache Directory = C:\Users\jprox\AppData\Local\NetBeans\Cache\dev assertions were disabled thread dump is attached
Created attachment 130452 [details] thread dump
(In reply to comment #7) > And BTW I am able to reproduce (both the exception and the hang) ... At least I > think I am able to reproduce ... So, could you please try to remove the assert (on "openide.text/src/org/openide/text/UndoRedoManager.java:397", keep the "addEdit" invocation) and try to reproduce the hang? That would help to find out if it is related or not. I unfortunately was not able to reproduce the hang. Thanks.
After I have removed the assert I am no longer able to reproduce the hang.
Ok, thanks. Almost surely duplicate of bug #225087. *** This bug has been marked as a duplicate of bug 225087 ***
Removing the keyword - the issue 225087 is HR fix candidate as well