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 35804 - [Threaddemo] often deadlocks when run under optimizeit
Summary: [Threaddemo] often deadlocks when run under optimizeit
Status: CLOSED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Performance (show other bugs)
Version: 3.x
Hardware: PC Other
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2003-08-27 15:31 UTC by Petr Hrebejk
Modified: 2011-05-25 11:36 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump (19.75 KB, text/plain)
2003-08-27 15:36 UTC, Petr Hrebejk
Details
Patch proposed by Jarda (1.06 KB, patch)
2003-08-27 15:37 UTC, Petr Hrebejk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Hrebejk 2003-08-27 15:31:48 UTC
when using with ant optit there is often a
deadlock. Will attach
patch proposed by Jarda.
Comment 1 Petr Hrebejk 2003-08-27 15:36:26 UTC
Created attachment 11455 [details]
Thread dump
Comment 2 Petr Hrebejk 2003-08-27 15:37:09 UTC
Created attachment 11456 [details]
Patch proposed by Jarda
Comment 3 Jesse Glick 2003-08-27 15:51:03 UTC
Thanks for the thread dump, but the patch is not quite right I think -
rather, Monitor should not start its timer until it is made visible;
certainly not in the constructor.
Comment 4 Jesse Glick 2003-08-27 16:22:04 UTC
Fixed by just running pack() and show() in EQ.
Comment 5 Jaroslav Tulach 2003-08-28 09:16:21 UTC
The patch solves the problem by correct ordering of locks.

Your solution by serialization of "messages" into a processing queue.

Arguing about good or bad is usually tricky, but as far as I know it
is ok to call pack() and show() from non-awt thread so the EQ solution
is a hack as it does not solve the root of the problem which is still
there and only removes code that is correct acording to all swing
threading rules.
Comment 6 Jesse Glick 2003-08-28 14:10:15 UTC
Huh? You should not have to explicitly acquire the AWT tree lock when
calling JTextComponent.setText from the EQ, surely.

It *is* normally OK to call pack() and show() for undisplayed
components. The problem was the timer that is part of Monitor - if the
system is running really slowly, you can get a clock tick on the timer
occurring before the pack() finishes laying out the component off EQ.

My preferred fix would be to not start the timer until the component
is really showing (i.e. JFrame.show()) but I was unable to find a
straightforward way of detecting this event - addNotify certainly
doesn't work, setVisible(true) is never called, even
ComponentListener.showing did not work. So, a different fix is just to
ensure that no uses of the tree lock occur off EQ, as I did.
Comment 7 Marian Mirilovic 2005-07-13 13:27:11 UTC
closed