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 119856 - Refactoring preview of Bpel files causes IDE to hang
Summary: Refactoring preview of Bpel files causes IDE to hang
Status: VERIFIED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Vladimir Yaroslavskiy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-24 05:25 UTC by Sonali Kochar
Modified: 2008-04-02 08:56 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump (15.74 KB, application/octet-stream)
2007-10-24 19:05 UTC, Sonali Kochar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sonali Kochar 2007-10-24 05:25:34 UTC
Product Version         = NetBeans IDE Dev (Build 071016)
  Operating System        = Windows XP version 5.1 running on x86
  Java; VM; Vendor        = 1.5.0_12; Java HotSpot(TM) Client VM 1.5.0_12-b04; Sun Microsystems Inc.

Steps to reproduce:
1) Create a new BluePrint1 project
2) Select purchaseOrder.xsd,
3) Refactor -> Rename
4) Type any new name, and click on Preview
5) In the usages tree, click on any Bpel usage... Please note you have to select a BPEL file usage to see this bug
6) The left hand side will show you a preview of the change in the Bpel file
7) Now click Do refactoring. The IDE hangs
Comment 1 Sonali Kochar 2007-10-24 19:05:52 UTC
Created attachment 51612 [details]
Thread dump
Comment 2 Sonali Kochar 2007-10-24 19:13:02 UTC
This is what I think is happening
1) When the user clicks on a Bpel file usage on the left hand side window, the XML refactoring code does the preview
using the following algorithm
     Start transaction on model
     o.n.m.bpel.refactoring.Renamer.doRefactoring( for the selected Bpel file only)
     Rollback transaction on the model 

2) Then when the user clicks on do refactoring, the XML refactoring code first tries to:
      rename the refactoring target file, 
      refresh the catalog model and, 
      then refactor the usages

3) When the code tried to refresh the catalog model by looking at each usage, it gets stuck trying to acquire a readLock
for the file that was previewed in step (1)

If you look at the thread dump, thats where the code is waiting for a readLock

I am going to request Vladimir to look into Bpel code and see why Renamer.doRefactoring() isn't releasing the readLock
when its done
Comment 3 Sonali Kochar 2007-10-25 04:34:19 UTC
Assigning to Vladimir so he can investigate further.
Comment 4 Vladimir Yaroslavskiy 2007-10-26 12:33:19 UTC
fixed in trunk and sierra:

Checking in BpelModelImpl.java;
/cvs/enterprise/bpel/bpelapi/src/org/netbeans/modules/bpel/model/impl/BpelModelImpl.java,v  <--  BpelModelImpl.java
new revision: 1.6.10.3; previous revision: 1.6.10.2

Checking in BpelModelImpl.java;
/cvs/enterprise/bpel/bpelapi/src/org/netbeans/modules/bpel/model/impl/BpelModelImpl.java,v  <--  BpelModelImpl.java
new revision: 1.8; previous revision: 1.7

Summary:
BpelModel must override rollbackTransaction() and invoke writeUnlock() at the end of rollback.
Comment 5 Vladimir Yaroslavskiy 2007-10-26 13:35:48 UTC
rollbackTransaction() should be more investigated
Comment 6 Vladimir Yaroslavskiy 2007-10-26 16:55:28 UTC
I've fixed deadlock:

xml refactoring framework calls:

bpelModel.startTransaction();
// changes
bpelModel.rollbackTransaction();

In BpelModelImpl startTransaction sets read/write locks
and invokes super.startTransaction(), but rollbackTransaction
was not overrided in bpel model (when bpel model was
implemented there was no rollbackTransaction method).
So, rollbackTransaction didn't unset read/write locks.

I have added this method in BpelModelImpl class.
It was implemented just as start/stopTransaction:
invokes super method and set/unset read/write locks.

But it looks like rollbackTransaction in AbstractModel
doesn't wrok properly: repeat the steps, you can
see in diff view that old and new files are the same.

Could you please, look at super rollbackTransaction?
It seems that super rollbackTransaction must undo
changes in bpel model but it doesn't happen.
Comment 7 Sonali Kochar 2007-10-26 23:27:11 UTC
I am not sure why the rollback is not happening. Before Vladimir's changes to BpelModelImpl, the
AbstractModel.rollbackTransaction() was rolling back the bpel model changes. The new method,
BpelModelImpl.rollbackTransaction(), does nothing but delegates the rollback to AbstrackModel.rollbackTransaction() but
now rollback doesnt happen and we have unsaved changes in the Bpel file after preview. Not sure what's happening. I have
verified that AbstractModel.rollbackTransaction() is getting executed with Vladimir's changes.

Vladimir, Nam, any ideas?

Comment 8 Vladimir Yaroslavskiy 2007-10-29 15:32:02 UTC
I've investigated AbstractModel and BPELModelImpl.
It seems that bpel model must rollback changes self:
to call own undo support.
Comment 9 Vladimir Yaroslavskiy 2007-10-29 15:32:43 UTC
 See changes:

diff -r1.8 BpelModelImpl.java
498c498
<             super.rollbackTransaction();
---
>           myUndoSupport.abortUpdate();
807a808,813
>         }
> 
>         protected void abortUpdate() {
>             ModelUndoableEdit mue = (ModelUndoableEdit) compoundEdit;
>             mue.justUndo();
>             super.compoundEdit = createCompoundEdit();
Comment 10 tonybeckham 2007-10-31 19:48:38 UTC
Fix Verified.

Product Version: NetBeans IDE Dev (Build 200710290000)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Linux version 2.6.22-14-generic running on i386; UTF-8; en_US (nb)