Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryLeak in TargetCacheImpl_DataApps #30315

Open
benjamin-confino opened this issue Nov 29, 2024 · 1 comment · May be fixed by #30325
Open

MemoryLeak in TargetCacheImpl_DataApps #30315

benjamin-confino opened this issue Nov 29, 2024 · 1 comment · May be fixed by #30325
Labels
release bug This bug is present in a released version of Open Liberty

Comments

@benjamin-confino
Copy link
Member

Describe the bug
TargetCacheImpl_DataApps has a WeakHashMap<String, TargetCacheImpl_DataApp>().

In the method getAppForcing we populate the map using apps.put(appName, app);. app is a TargetCacheImpl_DataApp

TargetCacheImpl_DataApp also takes an appName parameter. The same string is both inside used as the key, and stored inside the value so this will never release. I've also been informed that ensuring app uses a copy of the string causes even worse problems.

(I would like to give credit to Jared Anderson, he found out the details in the previous paragraph and left a helpful slack message that saved me the trouble of doing so. Apologies if there is an issue for this already, I didn't find one)

Steps to Reproduce
Running io.openliberty.microprofile.rest.client.4.0.internal_fat_tck is a good way to get a liberty server leak a lot of memory.

Expected behavior
TargetCacheImpl_DataApp's weak hash map's entries are garbage collected when an app is shut down.

@benjamin-confino benjamin-confino added the release bug This bug is present in a released version of Open Liberty label Nov 29, 2024
@benjamin-confino
Copy link
Member Author

I was able to make a quick dirty prototype that resolves this leak, by creating a listener for metadata created/destroyed events that creates object warppers around string names to use as keys in TargetCacheImpl_DataApp

The key must be the name of the application, which in turn must be the deploymentName from com.ibm.ws.container.service.app.deploy.ApplicationInfo (we have to many values for app names)

@benjamin-confino benjamin-confino linked a pull request Dec 3, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release bug This bug is present in a released version of Open Liberty
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant