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

Bug 366903

Summary: org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider has no dispose (not cleaning up resources)
Product: [WebTools] Dali JPA Tools Reporter: Kevan Holdaway <kholdaway>
Component: GeneralAssignee: Neil Hauge <neil.hauge>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: cbridgha, ccc, neil.hauge
Version: 2.3.3   
Target Milestone: 3.0.3   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 387992    
Attachments:
Description Flags
Add dispose method.
none
minor update none

Description Kevan Holdaway CLA 2011-12-15 17:51:15 EST
Build Identifier: 2.3.3 (version)

org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider creates a org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate but never calls its dispose method.  org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider should have a dispose method that cleans up all resources (listeners, LibraryInstallDelegate, etc).

Adding/removing the facet will cause these objects to be leaked.

Reproducible: Always

Steps to Reproduce:
1. Add/remove the JPA facet 5-10 times.
Comment 1 Kevan Holdaway CLA 2011-12-15 17:51:49 EST
If this is fixed in Head, please backport to 2.3.x if possible.
Comment 2 Neil Hauge CLA 2011-12-28 09:54:33 EST
Chuck...Do we have any plans for a WTP 3.2.6 release?
Comment 3 Neil Hauge CLA 2011-12-28 09:56:02 EST
Chuck...Do we have any plans for a WTP 3.2.6 release?
Comment 4 Kevan Holdaway CLA 2012-02-02 12:56:02 EST
Can I get an update on this?  Is there a plan to fix this in 3.0 maintenance?
Comment 5 Neil Hauge CLA 2012-02-02 13:27:40 EST
I would think this could be backported to 3.0.x.  Targeting to 3.0.2.
Comment 6 Neil Hauge CLA 2012-02-08 18:36:11 EST
Created attachment 210764 [details]
Add dispose method.

Upon adding the dispose() method to JpaFacetDataModelProvider I discovered that there appears to be a hole in data model provider disposal across WTP on facet addition, including Dali.  From what I can tell, none of the J2EE data model providers dispose() methods are being called when adding a facet from the Facets project properties page.  I'm not sure yet if this is a framework issue or something that clients are doing wrong, or perhaps I am just missing something.  In either case, the attached patch takes a step in the right direction so that when the framework does call dispose() (such as on facet version modification), we respond appropriately.  This patch should at least bring us on par with much of the rest of WTP.
Comment 7 Kevan Holdaway CLA 2012-02-09 10:08:41 EST
I noticed that too, however, we are using the JPA facet page in a wizard that does call dispose.  The Facet Framework should also be calling dispose from the Dynamic Web Project Wizard if it is not.  Either way, the facet page should assume that dispose is always called (or its a bug on the code that uses the facet page).
Comment 8 Neil Hauge CLA 2012-02-09 12:18:33 EST
Created attachment 210814 [details]
minor update

This is a minor update to avoid another listener leak that previously existed.
Comment 9 Neil Hauge CLA 2012-02-09 12:27:17 EST
(In reply to comment #7)
> I noticed that too, however, we are using the JPA facet page in a wizard that
> does call dispose.  The Facet Framework should also be calling dispose from the
> Dynamic Web Project Wizard if it is not.  Either way, the facet page should
> assume that dispose is always called (or its a bug on the code that uses the
> facet page).

Okay, so this would be more useful in the adopter setting.  Would you like for me to try and get this pushed into 3.0.2 RC3?  If it is a "hot" adopter issue then we can probably make it happen.  If a WTP 3.2.5 patch is what is needed, I can help with the necessary committer steps for that.
Comment 10 Kevan Holdaway CLA 2012-02-09 12:56:40 EST
At this point, we are based on WTP 3.2.5.  So we will need a patch for that.  I know we build patches and this one would need to be included.  I think Carl Anderson handles those.
Comment 11 Neil Hauge CLA 2012-02-09 13:24:27 EST
(In reply to comment #10)
> At this point, we are based on WTP 3.2.5.  So we will need a patch for that.  I
> know we build patches and this one would need to be included.  I think Carl
> Anderson handles those.

OK...let's focus on that (3.2.5 patch) for now then and we'll put this into Dali 3.0.3 so it is there when you pick up WTP 3.3.x.
Comment 12 Neil Hauge CLA 2012-02-24 17:01:26 EST
This patch has been committed to 3.0.3 and 3.2 streams.  Need to open clone bug for 3.2.5P stream.
Comment 13 Neil Hauge CLA 2012-08-24 10:09:49 EDT
Clone bug has been created...marking this as fixed.