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 48927 - failure in DefautDataObjectHasOpenTest
Summary: failure in DefautDataObjectHasOpenTest
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: TEST
Depends on:
Blocks:
 
Reported: 2004-09-13 13:08 UTC by pzajac
Modified: 2008-12-22 20:23 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
test's log (8.17 KB, text/html)
2004-09-13 13:08 UTC, pzajac
Details
test log (1.51 KB, text/plain)
2004-10-05 09:58 UTC, pzajac
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pzajac 2004-09-13 13:08:33 UTC
Test Case:  	
testBinaryFilesQuestionContainsOpenActions
Test Suite: 
org.openide.loaders. DefautDataObjectHasOpenTest
Module Name: 	openide
Jdk : jdk1.5rc
Comment 1 pzajac 2004-09-13 13:08:54 UTC
Created attachment 17578 [details]
test's log
Comment 2 David Konecny 2004-09-13 13:23:13 UTC
Either for Yarda or pnejedly?
Comment 3 Jaroslav Tulach 2004-09-13 17:55:22 UTC
This could never work. I'd like to know what I was thinking about
during commit.
Comment 4 Jaroslav Tulach 2004-09-13 18:28:23 UTC
Checking in unit/src/org/openide/loaders/DefautDataObjectHasOpenTest.java;
/cvs/openide/test/unit/src/org/openide/loaders/DefautDataObjectHasOpenTest.java,v
 <--  DefautDataObjectHasOpenTest.java
new revision: 1.6; previous revision: 1.5

Comment 5 pzajac 2004-09-16 14:35:44 UTC
The tests fails again on solaris. 

the testComponentCanBeSerialized:

      junit.framework.AssertionFailedError: DataObject can disappear
org.openide.loaders.DefaultDataObject@1a62c31[AbstractFileObject@64c34e[file:/var/tmp/fstests/lfstesttestComponentCanBeSerialized/AA/a.test]]
	at junit.framework.Assert.fail(Assert.java:47)
	at org.netbeans.junit.NbTestCase.assertGC(NbTestCase.java:844)
	at
org.openide.loaders.DefautDataObjectHasOpenTest.testComponentCanBeSerialized(DefautDataObjectHasOpenTest.java:258)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
Comment 6 Jaroslav Tulach 2004-09-16 16:27:01 UTC
I know this fails from time to time because there may be a reference
from AWT static variables. I'd like to know whether Petr N. has some
advice how to solve this. I have two problems:

1. I am not exactly sure what the object reference chain is as I am
not able to simulate the problem right now. Incorporate insane into
assertGC? Only run it if its classes are on classpath? 

2. When we find what is wrong, what do we do? Use reflection to
cleanup some static variables in assertGC?

Meanwhile I can disable the test, if seen important.
Comment 7 David Konecny 2004-09-16 17:03:41 UTC
"I know this fails from time to time" - somebody else who might have
to maintain this test in future might not know this and can spend
hours trying to figure out what's wrong. This is my experience with
Datasystems tests. I would suggest to put test like this one into a
special test bag like "known-to-fail-from-time-to-time" and keep them
there until they run reliably and *always* pass and if not there is
really a P2 problem. In my opinion unit tests which are randomely
failing are useless. On the other hand I understand that some our code
is hard to test reliably and so maybe special metric should be used
for tests from "known-to-fail-from-time-to-time" test bag: if a test
failed repeatedly 10? times in row then there is a problem and
somebody should look at it. It is P3 warning that something *might* be
wrong. Obscure, but better then current state when I'm getting P2
issues and  have to look at tests whose author maybe knew that they
might fail from time to time.
Comment 8 Jaroslav Tulach 2004-09-20 07:49:10 UTC
My experience from loader tests and especially CLIHandlerTest is that
even a test fails from time to time, it is possible (and desirable) to
fix it. I usually do that by improving logging in the test, so when it
fails I have idea what happened and in what order.

The problem with DefautDataObjectHasOpenTest is a bit different. I
know where the problem is (at least I think): the test opens a window
and then closes it and waits for it to be garbage collected. However
if the mouse pointer is inside the opened window the AWT calls
"updateCursorPointerImmedaitelly" and holds a pointer to the window
from a native code. So I do not need to improve logging (except using
insane to exactly know the reference path), but find a workaround to
prevent this.

Which I think I have. We could introduce a property in
DefaultWindowManager that would instruct it to perform all operations,
but without showing the JFrame on the screen and use that in our
tests. That would be more polite than blinking windows on our monitors
anyway.

Option?
Comment 9 Jaroslav Tulach 2004-09-22 16:29:02 UTC
cvs ci -m "#48927: Sometimes the lastSelected field could hold a
pointer to already closed Pane. Now we are using WeakReference instead
to allow it to be GCed."
cvs commit: Examining .
Checking in CloneableEditor.java;
/cvs/openide/src/org/openide/text/CloneableEditor.java,v  <-- 
CloneableEditor.java
new revision: 1.80; previous revision: 1.79
done
Checking in CloneableEditorSupport.java;
/cvs/openide/src/org/openide/text/CloneableEditorSupport.java,v  <-- 
CloneableEditorSupport.java
new revision: 1.134; previous revision: 1.133
Comment 10 pzajac 2004-10-05 09:57:37 UTC
the test fails again on solaris
Comment 11 pzajac 2004-10-05 09:58:46 UTC
Created attachment 18041 [details]
test log
Comment 12 Jaroslav Tulach 2004-10-05 12:02:30 UTC
cvs -q ci -m "#48927: Catching the assertGC exception until issue
49929 is implemented."
Checking in
test/unit/src/org/openide/loaders/DefautDataObjectHasOpenTest.java;
/cvs/openide/test/unit/src/org/openide/loaders/DefautDataObjectHasOpenTest.java,v
 <--  DefautDataObjectHasOpenTest.java
new revision: 1.7; previous revision: 1.6
Comment 13 pzajac 2004-10-13 08:58:06 UTC
test passed