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

FISH-5723 Fixes WebappClassloader memory-leak issue by removing JAXRSResources classes from cache on shutdown event #5102

Merged
merged 3 commits into from
Aug 1, 2022

Conversation

jGauravGupta
Copy link
Member

Signed-off-by: Gaurav Gupta gaurav.gupta@payara.fish

@jansupol
Copy link
Contributor

jansupol commented Jul 21, 2022

@jGauravGupta Thank you for the PR. I have two questions regarding the PR (perhaps I have a wrong understanding of @BeforeShutdown):

  1. The cache purge is done on @BeforeShutdown, i.e. when Weld container is being shutdown. Does the Cache get not garbage collected when shutdown?
  2. The CdiComponentProvider which holds the CdiComponentProviderRuntimeSpecifics is a CDI Extension, and Weld container keeps only a single instance of the class. (Well, there is another instance, not in Weld, but assumingly it has an empty Cache). Why do you purge the cache only for a single thread, instead of Cache.clear()?

@jGauravGupta
Copy link
Member Author

jGauravGupta commented Jul 26, 2022

Hello @jansupol ,

This issue is reproducible for both the Payara and Glassfish servers if the web application contains JAXRS resources.

Yes, the cache is not garbage collected by default on application un-deployment which holds the JAXRS resource classes reference of all deployed applications hence WebappClassloader is not garbage collected. @BeforeShutdown callback in the extension is invoked on the un-deployment of each application and removes the specific JAX-RS resource classes which belong to currently undeploying application classloader instead of 'Cache.clear()' (which will remove the cache for existing application).

@jansupol jansupol added this to the 3.0.6 milestone Aug 1, 2022
@jansupol jansupol merged commit 66ee890 into eclipse-ee4j:3.x Aug 1, 2022
@jansupol
Copy link
Contributor

jansupol commented Aug 1, 2022

@jGauravGupta Thanks!

senivam pushed a commit to senivam/jersey that referenced this pull request Aug 2, 2022
…Resources classes from cache on shutdown event (eclipse-ee4j#5102)

* FISH-5723 Fixes WebappClassloader memory-leak issue by removing JAXRS Resources classes from cache on shutdown event

Signed-off-by: Gaurav Gupta <gaurav.gupta@payara.fish>
senivam pushed a commit that referenced this pull request Aug 16, 2022
…Resources classes from cache on shutdown event (#5102)

* FISH-5723 Fixes WebappClassloader memory-leak issue by removing JAXRS Resources classes from cache on shutdown event

Signed-off-by: Gaurav Gupta <gaurav.gupta@payara.fish>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants