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

Jetty 9.4.x 5859 classloader leak queuedthreadpool #5894

Merged

Conversation

janbartel
Copy link
Contributor

See #5859

Ensure that QueuedThreadPool threads have their initial context classloader explicitly set, rather than defaulting to whatever the calling thread is using.

Signed-off-by: Jan Bartel <janb@webtide.com>
Signed-off-by: Jan Bartel <janb@webtide.com>
Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel janbartel requested a review from sbordet January 18, 2021 17:47
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@janbartel janbartel requested review from gregw and sbordet January 20, 2021 14:17
@janbartel
Copy link
Contributor Author

@gregw / @sbordet reviewing the OP's info from issue #5859, it seems to me that the QueuedThreadPool threads are also vulnerable to the problem he reported in the same issue regarding the ShutdownThread: namely the inheritance by a new Thread() of the calling AccessContext, containing a reference to the ProtectionDomain which has a reference to the current contextClassloader.

So the fix he suggested for ShutdownThread I've also applied to the QueuedThreadPool, and also rolled the fix for the ShutdownThread into this PR instead of opening a separate PR for it. Please (re)review.

Signed-off-by: Jan Bartel <janb@webtide.com>
Signed-off-by: Jan Bartel <janb@webtide.com>
Signed-off-by: Jan Bartel <janb@webtide.com>
Signed-off-by: Jan Bartel <janb@webtide.com>
Signed-off-by: Jan Bartel <janb@webtide.com>
This was referenced Mar 10, 2021
marcambier pushed a commit to gravitee-io/old-gravitee-api-management that referenced this pull request Nov 3, 2021
Jetty version has been upgraded in this commit : gravitee-io/gravitee-bom@6eb8566
It introduced mutliple regressions in APIM.

Since 9.4.37, Jettys threads classloaders have been refactored to fix a leak (see jetty/jetty.project#5894).
After this fix, threads classpath is override with local classpath, so it does not contain gravitee context class loader nomore (see https://github.com/eclipse/jetty.project/pull/5894/files#diff-6f0181889aa765771dd358e58fc07e2a7d7bfa44c451359e34e3eea574a5a79cR696).

Created a JettyQueuedThreadPool, to override Jetty's default QueuedThreadPool and give the gravitee context class loader to created threads.
marcambier pushed a commit to gravitee-io/old-gravitee-api-management that referenced this pull request Nov 3, 2021
Jetty version has been upgraded in this commit : gravitee-io/gravitee-bom@6eb8566
It introduced mutliple regressions in APIM.

Since 9.4.37, Jettys threads classloaders have been refactored to fix a leak (see jetty/jetty.project#5894).
After this fix, threads classpath is override with local classpath, so it does not contain gravitee context class loader nomore (see https://github.com/eclipse/jetty.project/pull/5894/files#diff-6f0181889aa765771dd358e58fc07e2a7d7bfa44c451359e34e3eea574a5a79cR696).

Created a JettyQueuedThreadPool, to override Jetty's default QueuedThreadPool and give the gravitee context class loader to created threads.
marcambier pushed a commit to gravitee-io/old-gravitee-api-management that referenced this pull request Nov 3, 2021
Jetty version has been upgraded in this commit : gravitee-io/gravitee-bom@6eb8566
It introduced mutliple regressions in APIM.

Since 9.4.37, Jettys threads classloaders have been refactored to fix a leak (see jetty/jetty.project#5894).
After this fix, threads classpath is override with local classpath, so it does not contain gravitee context class loader nomore (see https://github.com/eclipse/jetty.project/pull/5894/files#diff-6f0181889aa765771dd358e58fc07e2a7d7bfa44c451359e34e3eea574a5a79cR696).

Created a JettyQueuedThreadPool, to override Jetty's default QueuedThreadPool and give the gravitee context class loader to created threads.
marcambier pushed a commit to gravitee-io/old-gravitee-api-management that referenced this pull request Nov 3, 2021
Jetty version has been upgraded in this commit : gravitee-io/gravitee-bom@6eb8566
It introduced mutliple regressions in APIM.

Since 9.4.37, Jettys threads classloaders have been refactored to fix a leak (see jetty/jetty.project#5894).
After this fix, threads classpath is override with local classpath, so it does not contain gravitee context class loader nomore (see https://github.com/eclipse/jetty.project/pull/5894/files#diff-6f0181889aa765771dd358e58fc07e2a7d7bfa44c451359e34e3eea574a5a79cR696).

Created a JettyQueuedThreadPool, to override Jetty's default QueuedThreadPool and give the gravitee context class loader to created threads.
phiz71 pushed a commit to gravitee-io/old-gravitee-api-management that referenced this pull request Nov 3, 2021
Jetty version has been upgraded in this commit : gravitee-io/gravitee-bom@6eb8566
It introduced mutliple regressions in APIM.

Since 9.4.37, Jettys threads classloaders have been refactored to fix a leak (see jetty/jetty.project#5894).
After this fix, threads classpath is override with local classpath, so it does not contain gravitee context class loader nomore (see https://github.com/eclipse/jetty.project/pull/5894/files#diff-6f0181889aa765771dd358e58fc07e2a7d7bfa44c451359e34e3eea574a5a79cR696).

Created a JettyQueuedThreadPool, to override Jetty's default QueuedThreadPool and give the gravitee context class loader to created threads.
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.

3 participants