Bug 197510

Summary: EndorsedClassPathImpl.getResources blocked on repo indexer
Product: projects Reporter: _ gtzabari <gtzabari>
Component: MavenAssignee: Jesse Glick <jglick>
Status: VERIFIED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P2 CC: anebuzelsky, kawazu428, mentlicher, mmirilovic, musilt2, pjiricka
Version: 7.0Keywords: THREAD
Target Milestone: 7.0.1   
Hardware: PC   
OS: Windows 7 x64   
Whiteboard: 70patch1-verified
Issue Type: DEFECT Exception Report:
Bug Depends on:    
Bug Blocks: 195195    
Attachments: messages.log
thread dump
thread dump
messages.log

Description _ gtzabari 2011-04-06 19:54:34 UTC
Netbeans 7.0 RC1
Java build 1.7.0-ea-b135 (64-bit)

When I try opening a Maven project Netbeans hangs with a modal "opening project" dialog. I also noticed it is downloading a lot of data, probably the Maven repository index, but there is no visual indicator for this.

A few minutes later I terminated the process because nothing seemed to be happening. Please see messages.log which I have attached.
Comment 1 _ gtzabari 2011-04-06 19:54:55 UTC
Created attachment 107563 [details]
messages.log
Comment 2 Marian Mirilovic 2011-04-07 07:59:35 UTC
Could you please generate thread-dump once IDE hangs, attach it here and reopen? Also would be nice to know whether you are able to reproduce it regularly? Thanks in advance.
http://wiki.netbeans.org/GenerateThreadDump
Comment 3 _ gtzabari 2011-04-07 12:02:36 UTC
This issue is reproducible 100% of the time. I will attach the thread-dump and messages.log you requested.
Comment 4 _ gtzabari 2011-04-07 12:03:41 UTC
Created attachment 107584 [details]
thread dump
Comment 5 Jesse Glick 2011-04-07 14:02:17 UTC
EndorsedClassPathImpl.getResources should not block on the indexer. Even though it uses RepositoryQueries.loadedContexts to examine only repositories which have already been indexed, this could block if that particular repository is currently being reindexed. I am not really sure what the fix should be, since the boot CP information is really needed when the project is opened. Could just report the target/endorsed/*.jar in the boot CP initially, then fire a change later when the index becomes available (and just hope the user does no clean build in the meantime), but this will cause "churn" in the scanner. And there is no way to tell whether another thread is currently holding the mutex without actually trying to acquire it (Mutex supports no such API); would need to rewrite the locking system to use java.util.concurrent. Even that is subject to some race conditions unless a new API is introduced to run queries on just those repos with an up-to-date index not currently being reindexed - a risky fix.

Workaround should simply be to make sure all your repository indices are up to date before opening these projects. Or just wait for the reindexing to complete (and install a repository manager to avoid waiting for remote network connections in the future).
Comment 6 Jesse Glick 2011-04-07 14:04:10 UTC
*** Bug 197525 has been marked as a duplicate of this bug. ***
Comment 7 Jesse Glick 2011-04-08 22:46:02 UTC
(In reply to comment #5)
> Could just
> report the target/endorsed/*.jar in the boot CP initially, then fire a change
> later when the index becomes available (and just hope the user does no clean
> build in the meantime)

Better would be to ignore endorsed JARs initially, and post a task to check the loaded indices (or maybe all indices?) in a background thread, firing a change at the end - with the new endorsed CP containing either target/endorsed/*.jar or the corresponding repo entry. Still suffers from CP churn issue, but I guess that is the lesser of two evils.
Comment 8 Jesse Glick 2011-04-11 21:50:16 UTC
core-main #66903d8faa69
Comment 9 Quality Engineering 2011-04-12 08:44:00 UTC
Integrated into 'main-golden', will be available in build *201104120401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/66903d8faa69
User: Jesse Glick <jglick@netbeans.org>
Log: #197510: EndorsedClassPathImpl.getResources blocked on repo indexer
Check for repo analogues of target/endorsed/*.jar in a background thread only.
Comment 10 Jesse Glick 2011-04-12 13:24:39 UTC
*** Bug 197652 has been marked as a duplicate of this bug. ***
Comment 11 Jesse Glick 2011-04-14 16:51:57 UTC
*** Bug 197652 has been marked as a duplicate of this bug. ***
Comment 12 _ gtzabari 2011-05-14 17:32:00 UTC
I believe this issue is still not fixed.

Product Version: NetBeans IDE 7.0 (Build 201104080000)
Java: 1.6.0_25; Java HotSpot(TM) 64-Bit Server VM 20.0-b11
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)

I will attach messages.log and a thread dump.
Comment 13 _ gtzabari 2011-05-14 17:34:31 UTC
Created attachment 108295 [details]
thread dump
Comment 14 _ gtzabari 2011-05-14 17:34:49 UTC
Created attachment 108296 [details]
messages.log
Comment 15 Petr Jiricka 2011-05-16 07:44:38 UTC
Hi Gili, no, this is not fixed in the NB 7.0 release, it is only fixed in the post-7.0 codeline. Can you please try out the trunk development builds? http://bits.netbeans.org/download/trunk/nightly/

Also, this bug is marked as a 70patch_candidate, so it may be addressed in the nearest patch for 7.0.
Comment 16 Jesse Glick 2011-05-16 21:57:47 UTC
Right, the fix is not in 7.0. If it is verified and a backport to release70_fixes is requested then I will do that backport.
Comment 17 Jesse Glick 2011-05-16 21:58:09 UTC
*** Bug 198607 has been marked as a duplicate of this bug. ***
Comment 18 Marian Mirilovic 2011-05-17 07:07:43 UTC
Tomas, 
I know you are busy with something else, but could you please verify this issue, so we will fix it for Patch 1 ? Thanks in advance.
Comment 19 Tomas Danek 2011-05-17 07:22:24 UTC
(In reply to comment #18)
> Tomas, 
> I know you are busy with something else, but could you please verify this
> issue, so we will fix it for Patch 1 ? Thanks in advance.

Sure, this one occurred quite often for me in 7.0, i can try current dev build.
Comment 20 Tomas Danek 2011-05-17 11:29:00 UTC
tried to reproduce in recent  7.0.1dev build, and it seems to be really fixed -> verified.
Comment 21 Martin Entlicher 2011-05-18 14:42:30 UTC
The fix is merged into release70_fixes as changeset:   198556:72d5fbebf7cb
http://hg.netbeans.org/releases/rev/72d5fbebf7cb
The module specification number was already increased by changeset 4bba1140ade6.
Comment 22 Tomas Danek 2011-05-20 06:55:01 UTC
did not reproduce in patch 1.
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo