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 41544 - random deadlock on closing document
Summary: random deadlock on closing document
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P2 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: RANDOM, THREAD
Depends on:
Blocks:
 
Reported: 2004-03-31 15:00 UTC by pzajac
Modified: 2008-12-22 17:59 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ide.log (29.04 KB, text/plain)
2004-03-31 15:01 UTC, pzajac
Details
threads dump (18.11 KB, text/plain)
2004-03-31 15:02 UTC, pzajac
Details
DialogDisplayer(impl).notify enhanced with deadlock detection (9.92 KB, patch)
2004-07-26 13:43 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pzajac 2004-03-31 15:00:11 UTC
[nb36rc2][jdk 1.5.0beta-2] the form editor was 
disabled and again enabled. There was some 
exceptions. See to the attachment for ide.log. 
The deadlock occured when the form was closed. 
See to the attachment fot the deadlock threads 
dump.
Comment 1 pzajac 2004-03-31 15:01:32 UTC
Created attachment 14226 [details]
ide.log
Comment 2 pzajac 2004-03-31 15:02:11 UTC
Created attachment 14227 [details]
threads dump
Comment 3 _ ttran 2004-03-31 20:33:26 UTC
pzajac: next time please always mark deadlock issues w/ THREAD
keyword.  Thx

assigning to pnejedly
Comment 4 _ ttran 2004-03-31 20:39:02 UTC
need investigation but not a showstopper for NB 3.6 -> promo-D
Comment 5 Petr Nejedly 2004-04-01 07:55:22 UTC
Evaluation:

There is a .java file opened in editor (through JavaDL) and modified.

If you enable the form module, loader pool content changes and
during revalidation, the form claims ownership of the .java file (as
there is a .form file laying nearby).

Because there is an existing and valid JavaDO currently owning the
file, it have to be invalidated first.

Invalidation needs user cooperation as the file is modified
(save/discard dialog), but runs on different thread -> invokeAndWait

AWT is blocked waiting for some datasystems service so can't proceed
with the dialog, DS can't serve AWT as it is waiting for user response
-> deadlock
Comment 6 Petr Nejedly 2004-04-01 08:19:55 UTC
Possible solutions:
A) don't allow takeover of modified file
  - inconsistency
  - in fact needed only iff AWT blocked

B) discard the file
  - data loss

C) rewrite waitFinished to foxtrot-like behaviour when waiting in AWT
  - unreliable
  - hell to understand, hell to maintain, too much magic

D) A + rescheduled retry
  - not sure if it would work

E) ??? (I'm out of ideas now)

CCing gurus...
Comment 7 Petr Nejedly 2004-04-01 08:23:06 UTC
E) SaveAll before module set change (be on the safe side, new modules
can generally cause troubles ;-)
Comment 8 Petr Nejedly 2004-04-01 08:46:50 UTC
With Yarda, we think about this:
post a user dialog, give it timeout to show.
  If it goes through, save or discard according to user decision.
  If it doesn't, ban the takeover.

Maybe it could be extended with rescheduled retry scheme.
Comment 9 Jaroslav Tulach 2004-04-01 11:24:44 UTC
From user point of view I think showing the same dialog as is shown
before exit from the IDE when modules are changing with option to
saveall or cancel the operation is the best experience I can imagine
in this case.

Still we need to fix the CES. invokeLater () + wait(5000) is the best
way how to get from DataObject.setValid(...) missery. Looking forward
to see the test ;-)
Comment 10 pzajac 2004-04-01 11:44:17 UTC
I'm for Yarda solution. 
Comment 11 Jesse Glick 2004-04-01 15:37:41 UTC
Agreed, (E) is safest - make sure everything is saved before you fool
with this stuff.
Comment 12 Jaroslav Tulach 2004-07-26 13:43:17 UTC
Created attachment 16445 [details]
DialogDisplayer(impl).notify enhanced with deadlock detection
Comment 13 Jaroslav Tulach 2004-07-26 13:44:38 UTC
I am ready to fix this. I'll do saveAll during enable/disable modules
from UI and I am going to apply my patch which prevents the deadlock,
when it appears, to last forever.
Comment 14 Jaroslav Tulach 2004-07-27 10:44:47 UTC
Checking in src/org/netbeans/core/ui/ModuleBean.java;
/cvs/core/src/org/netbeans/core/ui/ModuleBean.java,v  <--  ModuleBean.java
new revision: 1.33; previous revision: 1.32
done
Processing log script arguments...
More commits to come...
Checking in
windows/src/org/netbeans/core/windows/services/DialogDisplayerImpl.java;
/cvs/core/windows/src/org/netbeans/core/windows/services/DialogDisplayerImpl.java,v
 <--  DialogDisplayerImpl.java
new revision: 1.5; previous revision: 1.4
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/services/DialogDisplayerImplTest.java,v
done
Checking in
windows/test/unit/src/org/netbeans/core/windows/services/DialogDisplayerImplTest.java;
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/services/DialogDisplayerImplTest.java,v
 <--  DialogDisplayerImplTest.java
initial revision: 1.1
Comment 15 pzajac 2004-08-09 16:08:15 UTC
cannot reproduce->verified