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 119813 [details] Thread dump. Deadlock between HintsController worker and org.netbeans.editor.CustomFoldManager appeared in automated tests while testing php editor. Product Version = NetBeans IDE Dev (Build 201205240002) (#fbd4c2288712) Operating System = Windows XP version 5.1 running on x86 Java; VM; Vendor = 1.7.0_02; Java HotSpot(TM) Client VM 22.0-b10; Oracle Corporation Runtime = Java(TM) SE Runtime Environment 1.7.0_02-b13
Not sure there is an actual deadlock: the AWT thread is runnable (and presumably also running), and both the "HintsController worker" and "org.netbeans.editor.CustomFoldManager" are waiting for it to finish. Maybe an infinite (or very long) loop?
BTW, the profiler snapshot might be useful in this case (as opposed to actual deadlocks, where thread dumps are typically more useful), to see the "dynamic" behavior.
It also seems to me more like an infinite loop, I've done a change in SyntaxHighlighting so it might be affected although the present tests pass ok. Is it reproducible?
Yes, it seems like infinite loop. Processor is at 99%. I can reproduce it on remote hudson slave but I can't get any profiler results from it.
I went through the SyntaxHighlighting class code but I did not find any problematic case. Since this does happen in a real IDE use marking as P3 until Jirka provides a reproducible test case.
It can be reproduced with this hudson job: http://hudson4qe.cz.oracle.com/job/_Temp-php.editor/
It's an infinite loop. Output of the test shows: [junit] SyntaxHighlighting.HSImpl <111,112> [junit] SH.moveTheSequence(): Highlight: <111,112> attrs=AttrSet[0,1]@12558708 S_NEXT_TOKEN, seq#=1 [junit] SyntaxHighlighting.HSImpl <111,112> [junit] SH.moveTheSequence(): Highlight: <111,112> attrs=AttrSet[0,1]@12558708 S_NEXT_TOKEN, seq#=1 [junit] SyntaxHighlighting.HSImpl <10,118> [junit] SH.moveTheSequence(): Highlight: <10,-1073741707> attrs=AttrSet[0,1]@11306677 S_NEXT_TOKEN, seq#=1 [junit] SH.moveTheSequence(): Highlight: <-1073741707,-1073741707> attrs=AttrSet[0,1]@11306677 S_NEXT_TOKEN, seq#=1 [junit] SH.moveTheSequence(): Highlight: <-1073741707,-1073741707> attrs=AttrSet[0,1]@11306677 S_NEXT_TOKEN, seq#=1 [junit] SH.moveTheSequence(): Highlight: <-1073741707,-1073741707> attrs=AttrSet[0,1]@11306677 S_NEXT_TOKEN, seq#=1 [junit] SH.moveTheSequence(): Highlight: <-1073741707,-1073741707> attrs=AttrSet[0,1]@11306677 S_NEXT_TOKEN, seq#=1 etc. I will do some more research why this happens and possibly make SyntaxHighlighting more robust for this case.
I have added an extra debug and there seems to be a racing condition that corrupts lexer tokens and because of that the SyntaxHighlighting then gets into an infinite loop.
Created attachment 121650 [details] Corrupted token list (shows negative offsets of some already existing tokens IHC==Identity Hash Code of the tokens is the same)
There were several non-readlocked accesses mostly from typing hooks which I've fixed. I'll check whether it has any effect on this issue. http://hg.netbeans.org/jet-main/rev/ed973b1fad76
It looks that it helped. The test failed but this time it's likely due to too much logging output from the test causing it to time out. So I've disabled the logging and put an official jet-main build there and restarted the test.
Integrated into 'main-golden', will be available in build *201207030834* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/ed973b1fad76 User: Miloslav Metelka <mmetelka@netbeans.org> Log: #212950 - Race condition in Lexer and infinite loop in SyntaxHighlighting - fixed non read-locked lexer accesses.
This fix makes the SyntaxColoring more robust against invalid offset values: http://hg.netbeans.org/jet-main/rev/46e32441600f I will re-run the test to test that.
Integrated into 'main-golden', will be available in build *201207080002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/46e32441600f User: Miloslav Metelka <mmetelka@netbeans.org> Log: #212950 - Race condition in Lexer and infinite loop in SyntaxHighlighting - be more robust against invalid offsets from lexer.
The test now does not timeout so marking as fixed.
The test now sometimes passes but usually it fails.
It is no more reproducible in build 20130902001, JDK7u40.