Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318222

Summary: ModifyFacetedProjectWizard is not releasing some references.
Product: [WebTools] WTP Common Tools Reporter: Adrian Padilla <adrianpade14>
Component: Faceted Project FrameworkAssignee: wst.common <wst.common-inbox>
Status: RESOLVED NOT_ECLIPSE QA Contact: Konstantin Komissarchik <konstantin>
Severity: normal    
Priority: P3 CC: mcraquel
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
References hold by ModifyFacetedProjectWizard
none
Another format of the same snap.csv file none

Description Adrian Padilla CLA 2010-06-28 14:28:56 EDT
Build Identifier: M20100211-1343

if I use the following code:
Class SomeWizardPage extends WizardPage{
...
ModifyFacetedProjectWizard facetedWizard = new ModifyFacetedProjectWizard(fpjwc);
WizardDialog dialog = new WizardDialog(shell, facetedWizard);
dialog.open();
...
}

And I profile the code, every time I run through this code I get another reference to SomeWizardPage in the memory, and if I remove 
those lines from the code, the extra references goes away.

The must odd thing is that only when I click finish button inside the ModifyFacetedProjectWizard I get the extra references, because if I click on cancel everything works fine. The problem is present even if I overwrite the performFinish() method inside the ModifyFacetedProjectWizard.

I think this also affects the New Dynamic Web Project Wizard(and other wizards) using the Modify... button.


Reproducible: Always

Steps to Reproduce:
-----------Using the code sniped I give-------------------------
1.Use some code like the one I post
2.Profile such code with some Profiling tool
3.Verify that every time you go through that code and click on Finish in the ModifyFacetedProjectWizard, you got an extra reference for the WizardPage you used to create the ModifyFacetedProjectWizard instance.

--------------Using New Dynamic Web Project Wizard----------------
1.- open the New dynamic web project wizard
2.- click on Modify... button in configuration group
3.- click OK in the Project Facets Dialog.
4.- click Cancel in the New Dynamic Web Project Wizard.
5.- take a snapshot.
6.- repeat steps 1-5
7.- Compare the two snapshots, you will see some extra facet references.
Comment 1 Konstantin Komissarchik CLA 2010-06-28 14:50:27 EDT
Does your profiler let you examine what's holding these references? If so, post that here.
Comment 2 Adrian Padilla CLA 2010-06-28 17:52:11 EDT
Created attachment 172976 [details]
References hold by ModifyFacetedProjectWizard

My profiler only shows which references some object is holding, but it does not tell me (or I don't know how to) who is holding some reference. I will attach what I can get with it. Please let me know if you prefer a different format for the file or need anything else.
Comment 3 Konstantin Komissarchik CLA 2010-06-28 18:18:42 EDT
I am not sure what the attached CSV represents. It certainly hasn't helped to clarify the situation.

Since you are already profiling this code, I would recommend that you take this a step further and figure our where those references are being held. Most profilers will let you trace reference trees.
Comment 4 Adrian Padilla CLA 2010-06-29 10:14:47 EDT
Created attachment 173001 [details]
Another format of the same snap.csv file

Sorry the snap.csv is not useful at all, I didn't verify it exports the tree itself, here is another format where you can actually see the tree, sorry about that :P. The limitation my profiler has is that I can´t see who is holding the ModifyFacetedProjectWizard, but in here you can see the EarProjectWizard reference hold by ModifyFacetedProjectWizard.
Comment 5 Konstantin Komissarchik CLA 2010-06-29 17:03:07 EDT
Thanks for the additional output.

> The limitation my profiler has is that I can´t see who is holding the
> ModifyFacetedProjectWizard, but in here you can see the EarProjectWizard
> reference hold by ModifyFacetedProjectWizard.

I don't think the output shows what you think it shows. EarProjectWizard is a subclass of ModifyFacetedProjectWizard. This output doesn't show object instance id of any kind (at least none that I could see), so cannot tell whether this object tree in turn references another instance of ModifyFacetedProjectWizard like your initial post suggests.
Comment 6 Konstantin Komissarchik CLA 2010-06-29 17:07:49 EDT
> if I use the following code:
> Class SomeWizardPage extends WizardPage{
> ...
> ModifyFacetedProjectWizard facetedWizard = new
> ModifyFacetedProjectWizard(fpjwc);
> WizardDialog dialog = new WizardDialog(shell, facetedWizard);
> dialog.open();
> ...
> }
> 
> And I profile the code, every time I run through this code I get another
> reference to SomeWizardPage in the memory, and if I remove 
> those lines from the code, the extra references goes away.

Could you provide a more complete repro?

> I think this also affects the New Dynamic Web Project Wizard(and other wizards)
> using the Modify... button.

It shouldn't. The modify button doesn't launch another instance of ModifyFacetedProjectWizard. It just opens a facet selection dialog. See PresetSelectionPanel.handleModifyButtonPressed().
Comment 7 Konstantin Komissarchik CLA 2010-08-16 20:24:48 EDT
Closing pending more conclusive evidence that there is a WTP problem here vs an issue with adopter product.