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

Bug 324315

Summary: There seems to be a memory leak in the server image decorator
Product: [WebTools] WTP ServerTools Reporter: Rajiv Senthilnathan <rajiv.senthilnathan>
Component: wst.serverAssignee: Angel Vera <arvera>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: critical    
Priority: P2 CC: kaloyan, tjbishop
Version: 3.2Flags: arvera: pmc_approved? (david_williams)
arvera: pmc_approved? (raghunathan.srinivasan)
arvera: pmc_approved? (naci.dai)
deboer: pmc_approved+
arvera: pmc_approved? (neil.hauge)
kaloyan: pmc_approved+
Target Milestone: 3.2.2   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/108989
Whiteboard: PMC_approved
Attachments:
Description Flags
v1.0
none
v1.1 none

Description Rajiv Senthilnathan CLA 2010-09-02 10:54:24 EDT
Build Identifier: latest in CVS as of Sept 9, 2010

When using a server that is an instance of IServer we find the org.eclipse.wst.server.ui.internal.cnf.ServerLabelProvider class getImage() method creates new Image objects each time that an image is requested which is causing the leak.

Reproducible: Always

Steps to Reproduce:
1. Easy way to reproduce is to set a breakpoint after the server state is changed to starting but before the actual launch code is called. This will allow the state to stay in starting and cause the memory to keep leaking which can be observed with a process management tool.
Comment 1 Angel Vera CLA 2010-09-02 11:19:51 EDT
Created attachment 178054 [details]
v1.0

possible fix
Comment 2 Rajiv Senthilnathan CLA 2010-09-02 12:29:32 EDT
I've tested the patch and it looks good. I've had many servers (upto 7) in different states, started, starting, stopped, stopping and had tried to reproduce the problem but things looked stable. Usually I would hit the problem after about 30 minutes but with the patch it was running for more than 1 hour without issue.
Comment 3 Angel Vera CLA 2010-09-02 12:55:55 EDT
Thanks for the testing Rajiv.
Comment 4 Angel Vera CLA 2010-09-02 13:17:48 EDT
Created attachment 178070 [details]
v1.1
Comment 5 Angel Vera CLA 2010-09-02 13:19:33 EDT
Comment on attachment 178070 [details]
v1.1

Fixing the patch description. 
This patch adds a few extra checks.
Comment 6 Angel Vera CLA 2010-09-02 13:22:19 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 
This is an important bug to fix. In some cases the leak can be taking a lot of the memory and eventually crash the JVM with 'No more SWT handle' or Out of memory exceptions.

* Is there a work-around? If so, why do you believe the work-around is insufficient? 
No workaround

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
Rajiv and I have done testing, for the part the code has an impact. The image overlay and the loading of the images. Refer to comment #2 for more information about the testing. I did extra testing to ensure that the extra checks on the 1.1 patch are coded properly and do not affect the behaviour.

* Give a brief technical overview. Who has reviewed this fix? 
The fix is to create a cache of the image and retrieved the cached imaged instead of always creating new overlay images.
We also added a few extra to avoid extra loading.

* What is the risk associated with this fix? 
Minimal
Comment 7 Angel Vera CLA 2010-09-03 10:18:01 EDT
Changed committed to 3.2M
Comment 8 Angel Vera CLA 2010-09-03 10:19:06 EDT
Changes released to 3.2M
Comment 9 Angel Vera CLA 2010-09-03 11:01:01 EDT
changes committed and released to HEAD
Comment 10 Eclipse Genie CLA 2017-10-11 16:34:45 EDT
New Gerrit change created: https://git.eclipse.org/r/108989