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 152816 [details] Thread dump. Several threads are locked (see attached thread dump) and I am not sure which one is the culprit. Please, try to evaluate. I did: - create java project - added lines to main class for (int i = 0; i < 10; i++) System.out.println("aaa"); if (true) System.out.println("aaa"); - open Tools, Options, Editor, Hints - tick Braces - click Apply - click OK. Then scanning started and IDE was locked. Product Version: NetBeans IDE Dev (Build 1) Java: 1.8.0_40; Java HotSpot(TM) 64-Bit Server VM 25.40-b25 Runtime: Java(TM) SE Runtime Environment 1.8.0_40-b26 System: Windows 8 version 6.2 running on amd64; Cp1250; en_US (nb)
Reproducible for me. I am looking for the culprit
could it be svata's changes in at org.openide.filesystems.Repository.getLocalRepository(Repository.java:415) ?
I think I "just" helped the issue to surface by introducing additional default Lookup lookup. IMHO the FolderOrder should not hold the instance lock while writing to the filesystem (= dispatching lower-layer events under higher-layer lock).
Please see the proposed patch. I don't believe the issue is fixable in Repository.getLocalRepo or FileUtil.getConfigFile - the Provider must be looked up all the time. Some caching (i.e. do not lookup instance for the previously used Lookup) could help in Netbeans IDE, but would not solve the bug in general. I've however noticed that the deadlock is caused by some observer on the order reacting in the middle WHILE the lock on FolderOrder is still held. The FolderOrder code indicates that all the field changes are already done, and the lock is held just in order to prevent simultaneous setOrders to damage file attributes (so the order setOrder write will be eventually locked out). I think that doing the FS mutations in FS.AtomicAction will postpone listener reactions so it will effectively break the deadlock, while the potential concurrent FOrder.write() will be still locked out. See + review the attached patch, please.
Created attachment 152836 [details] Proposed changes
The evaluation is very reasonable, and the patch seems fine to me. Thank you, Svata.
Will be fixed in jet-main#ae0e0d5f9a02
Integrated into 'main-silver', will be available in build *201503270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/ae0e0d5f9a02 User: Svata Dedic <sdedic@netbeans.org> Log: #251398: FolderOrder delays FS events until after sync lock is released