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 150555

Summary: Complete hang when renaming web project using variables
Product: java Reporter: giorgio42 <giorgio42>
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: VERIFIED FIXED    
Severity: blocker CC: dkonecny, pjiricka, sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: jstack -l dump while hanging.
Second jstack -l dump

Description giorgio42 2008-10-17 14:41:45 UTC
NB 200810160201

What I did:
0) Install NB and enter a variable REPOSITORY in Tools->Variables pointing to some maven-style jar kitchen sink.
1) Create web project.
2) Reference library (in my case ojdbc14.jar) from project.
3) Rename project.
NB hangs with progress bar stopping at 80%.
Comment 1 giorgio42 2008-10-17 14:42:42 UTC
2) should have read
2) Reference library (in my case ojdbc14.jar) from project using REPOSITORY/ojdbc14.jar.

Comment 2 giorgio42 2008-10-17 14:43:44 UTC
Created attachment 72132 [details]
jstack -l dump while hanging.
Comment 3 giorgio42 2008-10-17 14:44:18 UTC
Created attachment 72133 [details]
Second jstack -l dump
Comment 4 giorgio42 2008-10-17 14:47:12 UTC
After killing NB private.properties contains this line (among others):
file.reference.ojdbc14.jar=C:\\home\\a0796942\\projects\\experimental\\WebApplication4\\${var.REPOSITORY}\\oracle-10.1\\jars\\ojdbc14.jar

and the reference is broken.
Comment 5 Jan Pokorsky 2008-10-17 15:24:28 UTC
Why refactoring component?

EDT is blocked by web project rename. Reassigning.
Comment 6 giorgio42 2008-10-17 16:34:27 UTC
> Why refactoring?

On second thought it should have been obvious that renaming a project is fundamentally different from renaming packages,
classes and so on. Next time I am not sure I'll choose IDE.

But if the rename ran through would it leave the correct contents in project.properties?

Cheers,
Georg
Comment 7 David Konecny 2008-10-19 23:32:16 UTC
Re. "deadlock" - this deadlock is not related to IDE variables. The deadlock is between Project.MUTEX and
api.java.classpath.ClassPath. Tomas, first thing which seems to me dangerous is that ClassPath.createEntries() is
calling SPI implementations while holding lock on instance of ClassPath. Is that necessary? Do you think that could be
fixed? If not then possible *workaround* would be to use AWT.invokeLater in SourceRoots.resetCache(SourceRoots.java:468).

RE. "wrong path in private.properties" - giorgio42, I would appreciate any steps how to reproduce.
Comment 8 David Konecny 2008-10-20 20:11:14 UTC
Passing to Tomas for evaluation of ClassPath.createEntries().
Comment 9 giorgio42 2008-10-21 15:31:36 UTC
RE. "wrong path in private.properties" - giorgio42, I would appreciate any steps how to reproduce.

Perform the steps as described, close NB, reopen NB and the project, look at nbproject/private/project.properties.

It will contain lines like these:
file.reference.ojdbc14.jar=C:\\home\\a0796942\\projects\\experimental\\WebApplication4\\${var.REPOSITORY}\\oracle-10.1\\jars\\ojdbc14.jar

instead of 
file.reference.ojdbc14.jar=${var.REPOSITORY}\\oracle-10.1\\jars\\ojdbc14.jar

Comment 10 Jan Becicka 2008-10-22 12:31:00 UTC
Tomasi, please evaluate. Thanks
Comment 11 Tomas Zezula 2008-10-23 10:11:08 UTC
Deadlock among classpath lock and project mutex.
To dkonecny:
>first thing which seems to me dangerous is that ClassPath.createEntries() is calling SPI implementations while holding lock on instance of ClassPath
Nice idea, however completely useless. The classpath does as much as it can not to call the SPI under the lock, it splits the critical sections, uses lamport 
clocks to prevent race conditions. If you look to the code you will find out that the PathResources were collected outside of the critical section. In the critical 
section only PR.getRoots() was called which resulted in simply returning the array of URLs, but it seems that ProxyFilteringCPI.getRoots tries to acquire project 
lock. On the other side, I can use your argument that project infrastructure calls SPI code (listeners) under lock.

Comment 12 David Konecny 2008-10-23 20:07:52 UTC
So what are you suggesting to do?

Re. "I can use your argument that project infrastructure calls SPI code (listeners) under lock" - true.
Comment 13 Tomas Zezula 2008-10-23 20:35:40 UTC
I will try to do a snapshot of roots where I'm doing the snapshots of PathResources (outside critical section).
But I need to test it for a while if it doesn't introduce a race condition, probably a random test is the best for this.

Comment 14 David Konecny 2008-10-23 20:41:02 UTC
Make sense. Thanks.
Comment 15 Tomas Zezula 2008-10-27 13:53:53 UTC
Fixed: http://hg.netbeans.org/main/rev/e7476997924e
Comment 16 Quality Engineering 2008-10-28 05:02:50 UTC
Integrated into 'main-golden', will be available in build *200810280201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e7476997924e
User: Tomas Zezula <tzezula@netbeans.org>
Log: #150555:Complete hang when renaming web project using variables
Comment 17 Jiri Prox 2008-11-20 13:03:51 UTC
I cannot reproduce the problem in trunk -> verified
Comment 18 pslechta 2008-11-20 14:32:27 UTC
The fix was backported into release65_fixes repository.

http://hg.netbeans.org/release65_fixes/rev/a7f1190c8886
Comment 19 Jiri Prox 2008-12-03 11:11:02 UTC
verified in patch 1