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 137947 - thread logic in ant.ProjectProperties$PP is broken
Summary: thread logic in ant.ProjectProperties$PP is broken
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: RANDOM, THREAD
: 128618 (view as bug list)
Depends on: 155037 167784
Blocks:
  Show dependency tree
 
Reported: 2008-06-23 11:34 UTC by Maksim Khramov
Modified: 2009-07-31 12:43 UTC (History)
17 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exceptions stacktrace for this issue (11.51 KB, text/plain)
2008-06-23 11:34 UTC, Maksim Khramov
Details
two exceptions: assert and its cause (8.63 KB, text/plain)
2008-07-02 04:38 UTC, David Konecny
Details
stacktrace (5.11 KB, text/plain)
2009-04-22 19:03 UTC, athompson
Details
stacktrace (5.11 KB, text/plain)
2009-04-23 14:32 UTC, Filip Zamboj
Details
stacktrace (4.38 KB, text/plain)
2009-04-23 16:13 UTC, Filip Zamboj
Details
stacktrace (9.63 KB, text/plain)
2009-05-08 15:30 UTC, juneau001
Details
stacktrace (9.63 KB, text/plain)
2009-05-08 15:53 UTC, juneau001
Details
stacktrace (5.62 KB, text/plain)
2009-05-13 15:03 UTC, rmatous
Details
stacktrace (6.69 KB, text/plain)
2009-05-27 12:37 UTC, juneau001
Details
stacktrace (3.95 KB, text/plain)
2009-06-17 09:23 UTC, matusdekanek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Khramov 2008-06-23 11:34:31 UTC
Product Version: NetBeans IDE Dev (Build 200806230002)
Java: 1.6.0_05; Java HotSpot(TM) Client VM 11.0-b11

Steps to reproduce:
Delete NetBeans workdir before run it.
Import limewire project into Netbeans.
The exceptions are thrown: 
java.lang.AssertionError
and
java.lang.IllegalArgumentException: NB_REPORTER_IGNORE: Project limewire is not open and cannot be set as main.
(See full stacktrace in attach)
Project is created and classpaths is scanning but not opened in Netbeans.
Comment 1 Maksim Khramov 2008-06-23 11:34:55 UTC
Created attachment 63244 [details]
Exceptions stacktrace for this issue
Comment 2 David Konecny 2008-06-23 23:07:23 UTC
I randomly can see this exception but I'm not sure what's causing it. Try import again and it most probably will pass -
that's my experience.
Comment 3 David Konecny 2008-07-02 04:38:11 UTC
Created attachment 63792 [details]
two exceptions: assert and its cause
Comment 4 David Konecny 2008-07-02 04:56:53 UTC
Jesse,

what's your opinion on this one? I added a logging to ProjectProperties$PP.diskChange() to see who is changing the file
and reproduced the problem (I was lucky). I was expecting to get two stack traces where one of them is not properly
using PM.MUTEX.writeAccess and that will be it. But as you can see on attached file (I was not lucky in this case) both
of the stack traces are run under writeAccess. How is it possible that PP is altered by both of them? My only
explanation is that file change events (thread-1) are actually fired outside of writeAccess allowing other thread
(thread-2) to enter writeAccess and start changing it and later thread-1 resets loaded flag causing even later thread-2
to throw the assert.

Synchronization of Importer and ImportProjectAction was slightly wrong allowing ImportProjectAction to start opening
projects while Importer was still in writeAccess (see removal of Importer.done variable in next commit). But because
J2SEProject open hook runs under write access it still should not result into this assert.

Different idea: perhaps ProjectProperties$PP.write() should not assert loaded == true but remember timestamp of loaded
properties (or null if file did not exist) and in write assert that timestamp has not changed or in case of null
timestamp assert that file still does not exist on disk.
Comment 5 Jesse Glick 2008-07-02 16:25:53 UTC
Yeah, I think the threading logic in PP is wrong. For one thing, it should probably be using FileEvent.firedFrom to
ignore disk changes fired when it is writing, rather than relying on the fluid variable 'writing'. Regarding the
'loaded' variable, responsible for this assertion, I'm not sure exactly what is going on; looks like a disk change is
arriving while modifications are being done in memory?
Comment 6 David Konecny 2008-10-21 20:24:19 UTC
*** Issue 128618 has been marked as a duplicate of this issue. ***
Comment 7 Exceptions Reporter 2009-04-20 04:40:47 UTC
This issue already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=20000
Comment 8 athompson 2009-04-22 19:03:08 UTC
Build: NetBeans IDE Dev (Build 200904220201)
VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Linux, 2.6.28-11-generic, amd64

User Comments: 
creating a sample project

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:219)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 9 athompson 2009-04-22 19:03:23 UTC
Created attachment 80721 [details]
stacktrace
Comment 10 Filip Zamboj 2009-04-23 14:32:28 UTC
Build: NetBeans IDE 6.7 Beta (Build 200904192254)
VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Linux, 2.6.27-11-generic, amd64

User Comments: 
creating  ServletExamples project from Samples Projects 

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:219)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 11 Filip Zamboj 2009-04-23 14:32:38 UTC
Created attachment 80764 [details]
stacktrace
Comment 12 Filip Zamboj 2009-04-23 16:12:58 UTC
Build: NetBeans IDE 6.7 Beta (Build 200904192254)
VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Linux, 2.6.27-11-generic, amd64

User Comments: 
changing server in run configuration from Tomcat to Glassfish

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:219)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 13 Filip Zamboj 2009-04-23 16:13:08 UTC
Created attachment 80783 [details]
stacktrace
Comment 14 juneau001 2009-05-08 15:30:09 UTC
Build: NetBeans IDE 6.7 Beta (Build 200904242137)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.6, i386

User Comments: 
Renaming a project - Web project

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:219)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 15 juneau001 2009-05-08 15:30:47 UTC
Created attachment 81811 [details]
stacktrace
Comment 16 juneau001 2009-05-08 15:53:18 UTC
Build: NetBeans IDE 6.7 Beta (Build 200904242137)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.6, i386

User Comments: 
Copying a web project and naming it something different.

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:219)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 17 juneau001 2009-05-08 15:53:51 UTC
Created attachment 81815 [details]
stacktrace
Comment 18 rmatous 2009-05-13 15:03:44 UTC
Build: NetBeans IDE Dev (Build 090507)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-b02, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b02
OS: Linux, 2.6.24-24-generic, i386

User Comments: 
after debugger started

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:217)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 19 rmatous 2009-05-13 15:03:53 UTC
Created attachment 82060 [details]
stacktrace
Comment 20 juneau001 2009-05-27 12:37:17 UTC
Build: NetBeans IDE 6.7 Beta (Build 200904242137)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.7, i386

User Comments: 
Opening a saved project			

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:219)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:337)
Comment 21 juneau001 2009-05-27 12:37:22 UTC
Created attachment 82855 [details]
stacktrace
Comment 22 matusdekanek 2009-06-17 09:22:46 UTC
Build: NetBeans IDE 6.7 RC3 (Build 200906142201)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Windows XP, 5.1, x86

User Comments: 
running the project in <default configuration> right after deleting some other configuration (the project scanning probably did not end)

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.spi.project.support.ant.ProjectProperties$PP.write(ProjectProperties.java:217)
        at org.netbeans.spi.project.support.ant.ProjectProperties.write(ProjectProperties.java:134)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:595)
        at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:102)
        at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:140)
        at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:346)
Comment 23 matusdekanek 2009-06-17 09:23:03 UTC
Created attachment 83675 [details]
stacktrace
Comment 24 Jesse Glick 2009-06-23 14:54:54 UTC
I can look at it.
Comment 25 Jesse Glick 2009-06-25 00:17:30 UTC
Improved some things in core-main #2645ec389548 & core-main #8162a3e2eaac which at a minimum should downgrade the
problem to an IOException. If this continues to be thrown, can attempt to diagnose further.
Comment 26 Quality Engineering 2009-06-25 20:27:12 UTC
Integrated into 'main-golden', will be available in build *200906251410* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2645ec389548
User: Jesse Glick <jglick@netbeans.org>
Log: Prep for #137947: use FileEvent.firedFrom in preference to fluid variables.