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 129819 - tests fail on assert
Summary: tests fail on assert
Status: RESOLVED DUPLICATE of bug 153526
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords: RANDOM, TEST
: 149229 149368 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-11 18:14 UTC by Alexander Ioffe
Modified: 2009-02-19 20:45 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace (2.78 KB, text/plain)
2008-03-11 18:16 UTC, Alexander Ioffe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Ioffe 2008-03-11 18:14:05 UTC
During running tests AssertionError appeares often very much.
Comment 1 Alexander Ioffe 2008-03-11 18:16:29 UTC
Created attachment 58182 [details]
Stack trace
Comment 2 Alexander Ioffe 2008-03-11 18:18:33 UTC
All cnd code completion tests fail because of this bug
Comment 3 Vitezslav Stejskal 2008-03-15 16:18:53 UTC
Any hints on where to go and what to run in order to reproduce this, please? Thanks
Comment 4 Dusan Balek 2008-03-17 09:53:28 UTC
Also, could you please try to run your tests with the 'org.openide.explorer.view.LazyListModel.skipExpensiveAsserts'
property set to true?
Comment 5 Alexander Ioffe 2008-03-18 17:41:35 UTC
Thanks for the hint with property key.
I've set it to true and no such Asserts any more.

What about how to reproduce. It's really difficult to explain. I'll try to do it
in a separate email.
Comment 6 Vitezslav Stejskal 2008-03-20 07:01:01 UTC
I assume the priority of this is now considerably lower, right?
Comment 7 Alexander Ioffe 2008-03-25 12:46:39 UTC
OK. Let it stay P4, but
I still have asserts. Not so often as without the key, but it's enough for braking tests.

So, my ask is to fix.

PS. Assert appeares after calling CodeCompletion list using 
Jelly oeprator 
CompletionJListOperator.showCompletion();
Comment 8 Dusan Balek 2008-03-25 13:17:50 UTC
Unfortunately, I'm not able to reproduce the issue. Could you please provide me with the exact steps to reproduce it?
Thanks.
Comment 9 Jiri Prox 2008-04-11 00:46:12 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 10 pribyl 2008-09-23 07:26:20 UTC
Product Version: NetBeans IDE Dev (Build 200809180201)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b15
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)

Unable to reproduce either. 
No additional info for more than o month -> closing INCOMPLETE issue

aioffe, please reopen if you are still experiencing this problem and provide some details how to reproduce.
Thanks!
Comment 11 Dusan Balek 2008-10-07 13:57:20 UTC
*** Issue 149229 has been marked as a duplicate of this issue. ***
Comment 12 Dusan Balek 2008-10-08 08:01:48 UTC
*** Issue 149368 has been marked as a duplicate of this issue. ***
Comment 13 Michael Nazarov 2008-10-21 12:47:20 UTC
My issue marked as duplicate so writing here.

I was able to reproduce test fail with specified property set to true as well
as without. Fail rate looks just the same in both cases. Please take a look to
this issue because it affects commit validation tests. Not very often, about
10% of executions, but very annoying.
Comment 14 Dusan Balek 2008-10-22 13:01:59 UTC
Could you please attach an example stack traces of asserts thrown with the property set to true? Thanks.
Comment 15 Michael Nazarov 2008-10-22 14:32:43 UTC
I can't post trace right now, because fail rate is very low and I need to do
many executions for. As I remember trace was just the same as already posted.
Well, it looks slightly strange, possibly I set property using wrong way so
it did not have effect really. Should I use -D or -D-J?

BTW I can't understand why existing trace is not enough for start fixing. It
shows point of fail and will property help or no this problem will not became
different. Correct me if I wrong.
Comment 16 Vitezslav Stejskal 2008-10-23 12:24:36 UTC
> Should I use -D or -D-J?

Definitely not -D-J, it should be -J-D. I'm not sure which one from -D or -J-D you should use. It depends on where you
are setting this property from. If the property goes through netbeans launchers (<nbinst>/bin/*) then -J-D should be used.


> BTW I can't understand why existing trace is not enough for start fixing.

Because of code changes an old stacktrace may become (partially or completely) useless at the time when a developer
tries to investigate a problem. In this particular case even you are not sure if the stacttraces with and without the
property set were the same. After inspecting the original stacktrace we concluded that setting the property should avoid
the problem. But you say that you still occasionally get the assertion and so chances are that the assertion is reached
from somewhere else, which would be shown on the new stactrace. Please post here the new stactrace when you get the
assertion next time. Thanks
Comment 17 Michael Nazarov 2008-10-28 07:32:58 UTC
I use simpletest started from command line and -J-D doesn't work.
Anyway I changed test sequence on our side and avoid this assertion somehow -- unfortunately this way easier.
Comment 18 Vitezslav Stejskal 2008-10-29 12:36:01 UTC
> I use simpletest started from command line and -J-D doesn't work.

Ok, no idea.


> Anyway I changed test sequence on our side and avoid this assertion somehow

So, the problem is no longer reproducible by running the tests, right?
Comment 19 Michael Nazarov 2008-10-29 12:39:30 UTC
Yes, that's correct. I can't say this is "right" because this is not right way to fix assertion fails.
Comment 20 Michael Nazarov 2008-10-31 10:17:15 UTC
Appeared again from another part of testing code.
http://deadlock.netbeans.org/hudson/job/trunk/4193/testReport/org.netbeans.test.php/Commit/ManipulateIndexPHP/
It's very good idea to fix it finally.

java.lang.AssertionError: external and checked must be consistent: 601
	at org.netbeans.modules.editor.completion.LazyListModel.externalContraints(LazyListModel.java:226)
	at org.netbeans.modules.editor.completion.LazyListModel.initialize(LazyListModel.java:307)
	at org.netbeans.modules.editor.completion.LazyListModel.getSize(LazyListModel.java:408)
	at javax.swing.plaf.basic.BasicListUI.convertModelToColumn(BasicListUI.java:1078)
	at javax.swing.plaf.basic.BasicListUI.getCellBounds(BasicListUI.java:793)
	at javax.swing.plaf.basic.BasicListUI.getCellBounds(BasicListUI.java:755)
	at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:277)
	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
	at javax.swing.JComponent.paintComponent(JComponent.java:743)
	at javax.swing.JComponent.paint(JComponent.java:1006)
	at org.netbeans.modules.editor.completion.CompletionJList.paint(CompletionJList.java:142)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at javax.swing.JViewport.paint(JViewport.java:728)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paint(JComponent.java:1015)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:559)
	at javax.swing.JComponent.paintChildren(JComponent.java:843)
	at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4979)
	at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4925)
	at javax.swing.JComponent.paint(JComponent.java:996)
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
	at java.awt.Container.paint(Container.java:1709)
	at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
	at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:56)
	at sun.awt.RepaintArea.paint(RepaintArea.java:224)
	at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:645)
	at java.awt.Component.dispatchEventImpl(Component.java:4060)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3819)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at org.netbeans.jemmy.QueueTool$JemmyQueue.dispatchEvent(QueueTool.java:610)
[catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 21 Dusan Balek 2008-11-19 16:05:45 UTC
It seems like a race condition that causes this problem. I've just added an assert to make sure, that ListModel methods
are called from AWT event thread only.

changeset 61ad9681ecc6 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=61ad9681ecc6

Could you please update the sources and run your tests again? Thanks
Comment 22 Michael Nazarov 2008-11-20 10:14:37 UTC
After your changes our tests became unusable and fail each time.
Would you please specify how to "call ListModel methods from AWT event thread" for Jemmy based tests.
Thanks.
Comment 23 Michael Nazarov 2008-11-27 06:32:57 UTC
PHP iTeam is really interested in fix of this issue because it affects each build.
We also disabled PHP tests which affected by issues till fix and now commit validation
for PHP contains almost nothing.
Property, specified as workaround, did not help BTW.
Comment 24 Dusan Balek 2008-11-27 08:09:30 UTC
The problem is that LazyListModel is not thread safe, because it is supposed to be called from AWT event thread only.
However the affected tests access it also from other threads (proved when I tried to add an assert last week) that
causes race conditions.

*** This issue has been marked as a duplicate of 153526 ***
Comment 25 Michael Nazarov 2008-11-27 08:18:14 UTC
Actually I wounder why other issue (153526) did not fixed yet. I'll try to force fix today.
Comment 26 Michael Nazarov 2008-11-27 13:35:55 UTC
Dusan, as I understand you removed your latest assertion with AWT thread check.
Would you please commit it back for a while, because we have fix and your code
is good for verify it is successful or no. Without your check code tests fail
occasionally and I really want to skip a lot of executions.
Comment 27 Dusan Balek 2008-11-27 16:38:15 UTC
Removed assert added back.

changeset df95cc7bad36 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=df95cc7bad36