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.
This concerns mostly classes o.n.m.c.repository.util.RepositoryCacheMap and o.n.m.c.repository.disk.SimpleRepositoryHelperCacheImpl that uses the former one. The idea of RepositoryCacheMap is to provide a cache for open files. This speeds up repository access a lot. But synchronization-related responsibilities spread between these classes, which is incorrect. This should be rewritten in such a way that RepositoryCacheMap is responsible for synchronization using an abstract factory pattern. The existing code is error prone.
In particular, the following problem should be fixed. Now it is possible that one and the same thread locks itself in the case when - some object is being read from persistence (from a single-file storage) - at this time it requests another read (from another single-file storage) In the case the 2-nd buffer tries to replace the 1-st one in the cache, the deadlock occurs (see the stack attached). The reason is that for the same ReadWriteLock first readLock is aquired, and then the same thread tries to aquire writeLock.
Created attachment 52347 [details] Stack fragment that illustrates the previous note
I believe there are no place in code model that uses persistence in such way; that's why I leave this P3.
Fixed by a number of recent commits: http://hg.netbeans.org/main?cmd=changeset;node=05a0b10e0a85 http://hg.netbeans.org/main?cmd=changeset;node=2168887464ba http://hg.netbeans.org/main?cmd=changeset;node=687eae066c2d http://hg.netbeans.org/main?cmd=changeset;node=8891080868bb http://hg.netbeans.org/main?cmd=changeset;node=c0ae5d653da5 http://hg.netbeans.org/main?cmd=changeset;node=440e988a1e3d http://hg.netbeans.org/main?cmd=changeset;node=bb5f2837a91f http://hg.netbeans.org/main?cmd=changeset;node=a701ff10092b http://hg.netbeans.org/main?cmd=changeset;node=801c87840680 etc