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 211358 - Locked by:csl.core.GsfDataObject$GenericEditorSupport$Environment.takeLock
Summary: Locked by:csl.core.GsfDataObject$GenericEditorSupport$Environment.takeLock
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: FTP Support (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on: 213141
Blocks:
  Show dependency tree
 
Reported: 2012-04-17 23:38 UTC by budgie67
Modified: 2012-05-30 05:31 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 147732


Attachments
stacktrace (3.96 KB, text/plain)
2012-04-17 23:39 UTC, budgie67
Details

Note You need to log in before you can comment on or make changes to this bug.
Description budgie67 2012-04-17 23:38:57 UTC
Build: NetBeans IDE Dev (Build 201204170400)
VM: Java HotSpot(TM) Client VM, 20.6-b01, Java(TM) SE Runtime Environment, 1.6.0_31-b05
OS: Windows 7

User Comments:
GUEST: Downloading and syncronising from ftp.

budgie67: file save

inkubus08: download remote file

bartdeslagmulder: Download from remote srouce (FTP).




Stacktrace: 
java.lang.Throwable: Locked by:
   at org.openide.filesystems.FileLock.<init>(FileLock.java:85)
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.<init>(LockForFile.java:91)
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:102)
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:359)
   at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1352)
   at org.netbeans.modules.csl.core.GsfDataObject$GenericEditorSupport$Environment.takeLock(GsfDataObject.java:229)
Comment 1 budgie67 2012-04-17 23:39:05 UTC
Created attachment 118428 [details]
stacktrace
Comment 2 Svata Dedic 2012-05-24 14:14:01 UTC
I have (at least I think) found a race condition in concurrent access to 'locked' property in FileLock, which might cause a bogus warning to be printed from its finalizer.

Except the above... the last report, which contains a really erroneous situation uses IDE from 2011-02-14. All relevant reports show a conflict between org.netbeans.modules.php.project.connections.RemoteClient.renameLocalFileTo and a modified document opened in the editor.

The relevant code has been changed in commit 4e89e166eff1 in Jan 2012; Tomas please verify whether this defect still applies, I don't think so.
Comment 3 Tomas Mysik 2012-05-25 04:31:09 UTC
Well, locking of the target file is still there so I am not sure that this should not happen anymore; is there anything I can do (improve) on the PHP side?
(I use the file lock since I am going to replace the content of the file.)

Thanks.
Comment 4 Svata Dedic 2012-05-25 14:08:02 UTC
Not sure; in the original stacktraces (see c.f. http://statistics.netbeans.org/exceptions/messageslog?id=419751), RemoteClient.renameLocalFileTo attempted to lock the file, but the file was already locked by EditorSupport because the user had been typing in the file's editor.

Maybe some better recovery from FileAlreadyLockedException would be useful: e.g. ask the user whether the unsaved changes should be thrown away or something like that.
Comment 5 Tomas Mysik 2012-05-28 06:06:11 UTC
OK, taking over, will ty to fix it.

Thanks.
Comment 6 Tomas Mysik 2012-05-29 08:59:31 UTC
Correct fix depends on issue #213141.
Comment 7 Tomas Mysik 2012-05-29 11:46:12 UTC
Should be fixed (work around for #213141 will be removed once it is fixed).

Thanks for reporting.

http://hg.netbeans.org/web-main/rev/3f8f13449044
Comment 8 Quality Engineering 2012-05-30 05:31:15 UTC
Integrated into 'main-golden', will be available in build *201205300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/3f8f13449044
User: Tomas Mysik <tmysik@netbeans.org>
Log: #211358 - Locked by:csl.core.GsfDataObject$GenericEditorSupport$Environment.takeLock