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 191378

Summary: Freeze with ParentVersionError.getErrorsForDocument waiting for repo indices
Product: projects Reporter: Jesse Glick <jglick>
Component: MavenAssignee: Antonin Nebuzelsky <anebuzelsky>
Status: RESOLVED FIXED    
Severity: normal Keywords: PERFORMANCE, THREAD
Priority: P2    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Sequence of thread dumps

Description Jesse Glick 2010-10-26 19:22:07 UTC
Created attachment 102655 [details]
Sequence of thread dumps

In a fairly new user dir, I tried to open the properties of a POM project with pom.xml open. The IDE went to 100% CPU and heavy disk for several minutes, with the UI frozen, then settled into an actual deadlock.

1. Livelock: EQ is waiting for a lock on the POM since the customizer holds a lock while open. StatusProvider$StatusProviderImpl.findHints locks the POM while calculating hints, reasonably enough. The problem is that ParentVersionError.getErrorsForDocument then forces update of all (local & remote) indices.

Probably the indexer should have a way of returning quickly from e.g. getVersions for repos which are not yet indexed; it could *trigger* the creation of the index asynch, but it should not *wait* for it to be finished. See loadIndexingContext for the logic; perhaps this could take a boolean force param and return boolean success, and if index && !force, return false; then e.g. getVersions could pass force=false and return immediately if result of loadIndexingContext is false.

Not clear if all callers of RQ methods should behave this way (return early upon missing index); would certainly be useful for fixing part of bug #191313, and in any other case where the result is just intended to be informational. TBD whether there are some use cases where it is appropriate to wait for indexing to complete.

2. Deadlock: some problem in POMModelImpl/AbstractModel with lock ordering. Seems that startTransaction both acquires a monitor on the model *and* acquires a semaphore, which seems inherently prone to deadlock. Here EQ has the monitor and is waiting for the semaphore, while "StatusProvider" thread holds the semaphore and is waiting for the monitor. Perhaps a bug in XAM/XDM.
Comment 1 Antonin Nebuzelsky 2010-11-10 16:37:47 UTC
Let's focus on #1 in this issue. Changing the summary.

#2 is now tracked separately in issue 191796.
Comment 2 Antonin Nebuzelsky 2010-11-11 14:03:06 UTC
core-main #618575a86d91