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.

Bug 205002 - "Could not lock document" from LexerBasedHighlightLayer.setColorings
Summary: "Could not lock document" from LexerBasedHighlightLayer.setColorings
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 205415 (view as bug list)
Depends on:
Blocks: 206858
  Show dependency tree
 
Reported: 2011-11-11 16:48 UTC by Jesse Glick
Modified: 2012-02-29 12:27 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-11-11 16:48:48 UTC
Thrown when I had a class structure open. Surely setColorings should not be using NbDocument.runAtomic, which takes out a write lock?!

INFO [org.openide.text.CloneableEditorSupport]: Could not lock document

msg
Caused: org.netbeans.modules.masterfs.filebasedfs.utils.FSException: Cannot lock read-only file <cachedir>/index/s580/java/14/gensrc/<p/C>.java.
	at org.netbeans.modules.masterfs.filebasedfs.utils.FSException.io(FSException.java:118)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:350)
	at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1352)
	at org.netbeans.modules.openide.loaders.SimpleES$Environment.takeLock(SimpleES.java:188)
	at org.openide.text.DataEditorSupport$Env.markModified(DataEditorSupport.java:950)
[catch] at org.openide.text.CloneableEditorSupport.notifyModified(CloneableEditorSupport.java:1991)
	at org.netbeans.modules.openide.loaders.SimpleES.notifyModified(SimpleES.java:123)
	at org.openide.text.CloneableEditorSupport.callNotifyModified(CloneableEditorSupport.java:1964)
	at org.openide.text.CloneableEditorSupport$Listener.vetoableChange(CloneableEditorSupport.java:2828)
	at org.netbeans.editor.BaseDocument.atomicLockImpl(BaseDocument.java:1610)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:310)
	at org.openide.text.NbDocument.runAtomic(NbDocument.java:422)
	at org.netbeans.modules.java.editor.semantic.LexerBasedHighlightLayer.setColorings(LexerBasedHighlightLayer.java:76)
	at org.netbeans.modules.java.editor.semantic.SemanticHighlighter$3$2.run(SemanticHighlighter.java:1520)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
Comment 1 Jan Lahoda 2011-11-13 22:02:46 UTC
I do not remember exactly why runAtomic was used (maybe to ensure that noone is reading the highlights?). I do not see a reason for it in the current code, so I will probably try to change the lock to a read lock. But, this worked fine for years (see #87642) - possibly related to redo after save? Mila, adding you on CC just in case you would be interested.
Comment 2 Miloslav Metelka 2011-12-28 14:42:59 UTC
Honzo, regarding runAtomic()/render() I wanted to ask the same question :) I've came to the same fix since Vladimir was complaining regarding beeping during Ctrl-TAB focus change between readonly files and I've found that this runAtomic() was the culprit.
I've run java.editor unit tests and they seem to pass fine.
http://hg.netbeans.org/jet-main/rev/48ecb1618e52
Comment 3 Quality Engineering 2011-12-29 13:59:55 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/48ecb1618e52
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #205002 - "Could not lock document" from LexerBasedHighlightLayer.setColorings
Comment 4 Tomas Stupka 2012-01-04 09:58:04 UTC
according to Mila, the provided patch solves also problems reported in #206858 which is a P1 regression. Please provide a patch for 7.1.
Comment 5 Tomas Stupka 2012-01-04 09:58:39 UTC
*** Bug 206858 has been marked as a duplicate of this bug. ***
Comment 6 Marian Mirilovic 2012-01-04 10:09:21 UTC
We will address this issue in Patch 1 for 7.1 (aka 7.1.1)
Comment 7 Miloslav Metelka 2012-02-01 10:46:52 UTC
*** Bug 205415 has been marked as a duplicate of this bug. ***
Comment 8 Jiri Prox 2012-02-07 13:19:10 UTC
verified in trunk
Comment 9 Jan Lahoda 2012-02-08 15:57:57 UTC
release71_fixes:
http://hg.netbeans.org/releases/rev/570517912912
Comment 10 Quality Engineering 2012-02-09 02:41:20 UTC
Integrated into 'releases', will be available in build *201202082200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/570517912912
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #205002 - "Could not lock document" from LexerBasedHighlightLayer.setColorings