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.
Summary: | Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@a866d6 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialProperty | ||
---|---|---|---|
Product: | projects | Reporter: | Lukas Jungmann <jungi> |
Component: | Ant Freeform | Assignee: | Milan Kubec <mkubec> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | alexvsimon, bogaerbr, dkonecny, gorrus, jglick, krystyna, mohhmekk, sflemming, theanuradha |
Priority: | P3 | Keywords: | THREAD |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://statistics.netbeans.org/exceptions/detail.do?id=1008 | ||
Issue Type: | DEFECT | Exception Reporter: | 1008 |
Attachments: |
stacktrace
stacktrace stacktrace stacktrace stacktrace stacktrace stacktrace suggested patch stacktrace stacktrace stacktrace stacktrace stacktrace stacktrace |
Description
Lukas Jungmann
2008-02-22 11:39:44 UTC
Created attachment 57056 [details]
stacktrace
Build: NetBeans IDE Dev (Build 20080228095928) VM: Java HotSpot(TM) Server VM, 10.0-b19 OS: Linux, 2.6.24-gentoo-r2, i386 User Comments: nothing (maybe scrolling using mouse wheel) Created attachment 57455 [details]
stacktrace
Build: NetBeans IDE Dev (Build 200803302302) VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b13 OS: Linux, 2.6.22-14-386, i386 User Comments: Created attachment 59546 [details]
stacktrace
Build: NetBeans IDE Dev (Build 080410) VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_05-b13 OS: Linux, 2.6.22-14-generic, i386 User Comments: Created attachment 60004 [details]
stacktrace
Obviously not in 6.1, please reevaluate. *** Issue 66195 has been marked as a duplicate of this issue. *** Build: NetBeans IDE Dev (Build 080715) VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_04-b12 OS: Windows Vista, 6.0, x86 User Comments: Had selected Build with Dependencies on projectui. Failed due to nbjdk.home being set to JDK 6. From a shell, I created nbbuild/user.build.properties pointing to JDK 5. Back in NB, selected Build > Repeat Build. Around that time this exception was thrown. Created attachment 64764 [details]
stacktrace
Build: NetBeans IDE Dev (Build 080826) VM: Java HotSpot(TM) Client VM, 11.0-b14, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b27 OS: Windows XP, 5.1, x86 User Comments: Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1775b59 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@13e1388 at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:874) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:319) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:291) Created attachment 68407 [details]
stacktrace
13 duplicates in exception reporter. Latest from 080826. Build: NetBeans IDE Dev (Build 200809120201) VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b14 OS: Windows XP, 5.1, x86 User Comments: I was just working with nb modules in IDE -opened projects - ColorChooser, Freeform Ant Projects, IDE Platform, Paint, Paint Application Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1001fd2 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@c66f48 at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:874) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:319) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:291) Created attachment 69826 [details]
stacktrace
Milosi, take this one. Created attachment 70667 [details]
suggested patch
Attached is the suggested patch. It synchronizes access to the intermediateEvaluators list, but still it can happen that an even arrives from the old intermediateEvaluators members when the current list gets recreated. I'm not sure why the assert is even there, it seems the safest change would be to just plainly delete the assert and fire change only if source==delegate. I'm not pushing the changes myself as it seems to increase the likelihood of some tests to fail. No idea why, it's incomprehensible what the tests do. The assertion is there because init says: if (delegate != null) { delegate.removePropertyChangeListener(this); } delegate = initEval(); delegate.addPropertyChangeListener(this); meaning that we should only be receiving events from the current delegate to begin with. There might be a race condition if two threads run this block of code at once, with the second thread overwriting the first thread's value of delegate without removing the PCL from the first thread's computed delegate. Possible fix would be something like: PropertyEvaluator newDelegate = initEval(); synchronized (somePrivateLock) { if (delegate != null) { delegate.removePropertyChangeListener(this); } newDelegate.addPropertyChangeListener(this); } This issue has already 20 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=1008 Not really a P2 issue, lowering priority back to P3. Build: NetBeans IDE Dev (Build 200810181401) VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06 OS: Linux, 2.6.25.17-jen67-pae, i386 User Comments: Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1974e21 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@81e6b0 at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:876) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:319) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:293) Created attachment 72202 [details]
stacktrace
Build: NetBeans IDE Dev (Build 081107) VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33 OS: Linux, 2.6.27-7-generic, i386 User Comments: Changing nbjdk.home values in nbbuild/user.build.properties and ~/.nbbuild.properties about the same time. Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@752e57 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1f36b30 at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:876) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:319) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$.run(PropertyUtils.java:293) Created attachment 73594 [details]
stacktrace
Build: NetBeans IDE Dev (Build 200812170242) VM: Java HotSpot(TM) Client VM, 11.0-b13, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b26 OS: Windows XP, 5.1, x86 User Comments: Save file on properties filed opened in Favorites window Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1d6d501 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@17b9c87 at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:876) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:319) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:293) Created attachment 75152 [details]
stacktrace
Build: NetBeans IDE Dev (Build 090112) VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03 OS: Linux, 2.6.27-9-generic, i386 User Comments: Added nbjdk.home=.../jdk6 and permit.jdk6.builds=true to nbbuild/user.build.properties. Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@135e847 rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1831a0c at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:876) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:319) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:293) Created attachment 75721 [details]
stacktrace
Build: NetBeans IDE Dev (Build 20090321211250) VM: OpenJDK Client VM, 14.0-b10, Java(TM) SE Runtime Environment, 1.6.0_14-ea-b01 OS: Windows XP, 5.1, x86 User Comments: when I run traget and stop it vis OUTput view action Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1023e4c rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@6cf2bf at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:876) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:320) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:293) Created attachment 78716 [details]
stacktrace
Seems reproducible to me, is it going to be fixed? Build: NetBeans IDE Dev (Build 20090402004259) VM: OpenJDK Client VM, 14.0-b10, Java(TM) SE Runtime Environment, 1.6.0_14-ea-b01 OS: Windows XP, 5.1, x86 User Comments: When build ant base project Stacktrace: java.lang.AssertionError: Got change from org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@118e80f rather than current delegate org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator@1632a05 at org.netbeans.modules.ant.freeform.FreeformEvaluator.propertyChange(FreeformEvaluator.java:181) at org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:876) at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:320) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:123) at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:109) at org.netbeans.spi.project.support.ant.PropertyUtils$FilePropertyProvider$1.run(PropertyUtils.java:293) Created attachment 79797 [details]
stacktrace
Always reproducible to me. Reproducible for me too, but not always. I tried Jesse's suggested fix, but no difference, still reproducible. Then I tried Milos's idea and again no difference, still reproducible. The problem is following (based on test case with user.build.properties file): 1) add two properties into the file, save the file 2) first PropertyChangeEvent with one of those properties is fired from source A 3) fireAnyChange() -> init() -> initEval() is called 4) old intermediateEvaluators are removed and listeners removed from them (including source A) 5) new intermediateEvaluators are created 6) THE PROBLEM: second PropertyChangeEvent with second of those properties is fired from source A, which was already removed from intermediateEvaluators Either logic in this class is broken or only one PropertyChangeEvent should be fired for one save operation on the property file. Jesse, which assumption is correct? "second PropertyChangeEvent with second of those properties is fired from source A" - sure, correct. "which was already removed from intermediateEvaluators" - that's OK too, but why is the evaluator receiving this event, if it already detached itself as a listener? SequentialPropertyEvaluator is suspicious: PropertyChangeListener[] _listeners; synchronized (listeners) { _listeners = listeners.toArray(new PropertyChangeListener[listeners.size()]); } for (PropertyChangeListener l : _listeners) { for (PropertyChangeEvent ev : events) { l.propertyChange(ev); } } Probably it should be using the standard PropertyChangeSupport rather than keeping List<PropertyChangeListener> listeners. Still this does not explain why it is firing an event to a listener which has already been removed. Using PropertyChangeSupport instead of list of listeners fixes the problem. http://hg.netbeans.org/core-main/rev/6e3881a4e264 Looking at the original source again, I guess the root problem is that the listener list was copied _before_ any events were delivered, and there can be more than one event (in the inner loop); whereas when using PropertyChangeSupport, the first event is delivered to all listeners (as a result of which the list of listeners can change), then the second event is delivered, and so on. Integrated into 'main-golden', will be available in build *200905041401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/6e3881a4e264 User: Milan Kubec <mkubec@netbeans.org> Log: #128134: using PropertyChangeSupport rather than list of listeners; added sync. to init() in FreefromEvaluator |