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.
to reproduce paste attached html document into html editor
Created attachment 39446 [details] exception
Created attachment 39447 [details] html document
increasing priority to P1, it is annoying
Vito, can you please take a look at the stacktrace? Looks like a highlighting layer issue. What came to my mind just from the simple fact that it is about a ConcurrentModificationException is that I probably cause this somehow by creating a dynamic embedding for javascript or css in HTML documents. If I am supposed to be synchronized with something or run from a particullar thread pls let me know. BTW, to reproduce, you need to build the html/editor from 'embedding_60' branch, I have sent an email to nb-scripting recently with a list of steps to build the html-schliemann-embedding editor. Thanks
I'll have a look. The synchronization code in CHC is probably wrong, but even when fixed the problem might not still be solved. CHC should only be accessed under the documents read lock, which by itself should provide sufficient synchronization. Anyway, I'll fix CHC and we will see if it bombs out somewhere else.
I'm struggling to reproduce this problem. There is nothing apparently wrong with synchronization of CHC. The ConcurrentME means that while one thread is iterating through highlights, some other thread modifies them. I tried the example html and added html/editor from the embedding_60 branch, but without success. No exception. I've added some diagnostics to CHC, which should show a stacktrace of the last thread that updated the CHC. Could you guys please try to reproduce the problem and attach the enhanced stacktrace? You will have to run the IDE with a special switch, eg: ant -Dtryme.args="-J-Dorg.netbeans.modules.editor.lib2.highlighting.CompoundHighlightsContainer.level=300" tryme Thanks. Checking in CompoundHighlightsContainer.java; /cvs/editor/lib2/src/org/netbeans/modules/editor/lib2/highlighting/CompoundHighlightsContainer.java,v <-- CompoundHighlightsContainer.java new revision: 1.3; previous revision: 1.2 done
I am attaching the IDE output with your switch. The debug exceptions are there. As for the reproduction - do you have javascript and css modules installed? If not, then the dynamic embeddings are not created and the probled doesn't show up, I guess.
Created attachment 39939 [details] The IDE output with debug exceptions
I have scripting/javascript (can see colored javascript tokens), but no css. Anyway, thanks for the exception, it shows that there is a conflict between EditorUpdater calling TokenSequence.createEmbedded and the component's repaint request. Your code correctly acquires the read lock before calling TS.createEmbedded, but this call modifies the tokens hierarchy, which is a change that, I think, normally happens under the write lock when a document is changed. Marku, could you please try acquiring the write lock before calling TS.cE? If it works we could use it as a hot fix for now and I'll discuss this with Mila.
Yes, I support the idea to acquire the write-lock for the custom embedding creation. Mainly because there is an issue 94365 for removal of a previously created custom embedding and that cannot be done without the write-lock because the token sequences already in use would suddenly fail. So using write-lock for both creation and removal would be symmetrical and IMHO desired.
changing status whiteboard
fixed by using NbEditorDocument.extWriteUn/Lock() as proposed. Checking in EmbeddingUpdater.java; /cvs/html/editor/src/org/netbeans/modules/html/editor/coloring/EmbeddingUpdater.java,v <-- EmbeddingUpdater.java new revision: 1.4.6.5; previous revision: 1.4.6.4 done
verified NetBeans IDE Dev (Build 20070923163726)