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

8273831: PrintServiceLookup spawns 2 threads in the current classloader, getting orphaned #5939

Closed
wants to merge 5 commits into from

Conversation

@mrserb
Copy link
Member

@mrserb mrserb commented Oct 14, 2021

The PrintServiceLookupProvider can spawn 2 threads on WIndows and one thread on Linux. These threads are connected to the classloader of the web application. During undeployment the app classloader gets removed together with the two orphaned threads by the Tomcat.

Looks like the tomcat has special machinery to workaround such threads:
https://cwiki.apache.org/confluence/display/tomcat/MemoryLeakProtection#MemoryLeakProtection-cclThreadSpawnedByJRE
But it should be updated each time we add/update/rename the threads in the JDK. So JreMemoryLeakPreventionListener can be updated to solve this problem, but it will be good to reset the ref to the app class loader as we usually do for our internal threads.

The change updates threads to use the root thread group and null context class loader.

A similar pattern is used here:

AccessController.doPrivileged((PrivilegedAction<Object>) () -> {

@aivanov-jdk please take a look


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8273831: PrintServiceLookup spawns 2 threads in the current classloader, getting orphaned

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5939/head:pull/5939
$ git checkout pull/5939

Update a local copy of the PR:
$ git checkout pull/5939
$ git pull https://git.openjdk.java.net/jdk pull/5939/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5939

View PR using the GUI difftool:
$ git pr show -t 5939

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5939.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 14, 2021

👋 Welcome back serb! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Oct 14, 2021

@mrserb The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

Loading

@openjdk openjdk bot added the client label Oct 14, 2021
@mrserb mrserb marked this pull request as ready for review Oct 14, 2021
@openjdk openjdk bot added the rfr label Oct 14, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 14, 2021

Webrevs

Loading

@mrserb
Copy link
Member Author

@mrserb mrserb commented Oct 29, 2021

Does anybody have some comments and/or suggestions?

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Oct 29, 2021

@mrserb This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8273831: PrintServiceLookup spawns 2 threads in the current classloader, getting orphaned

Reviewed-by: aivanov

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 219 new commits pushed to the master branch:

  • e89b2c0: 8276086: Increase size of metaspace mappings
  • 24cf480: 8276047: G1: refactor G1CardSetArrayLocker
  • e922023: 8275909: [JVMCI] c2v_readFieldValue use long instead of jlong for the offset parameter
  • 157e1d5: 8275856: Remove MetaspaceHandleDeallocations debug switch
  • c9e65f8: 8275440: Remove VirtualSpaceList::is_full()
  • de93b1d: 8257722: Improve "keytool -printcert -jarfile" output
  • 21da218: 8274848: LambdaMetaFactory::metafactory on REF_invokeSpecial impl method has incorrect behavior
  • 48f3fca: 8275308: Add valueOf(Runtime.Version) factory to SourceVersion
  • c6339cb: 8271820: Implementation of JEP 416: Reimplement Core Reflection with Method Handle
  • 5a768f7: 8276054: JMH benchmarks for Fences
  • ... and 209 more: https://git.openjdk.java.net/jdk/compare/b1b83500a9c3a74bf39894e49eefd031d208b9b9...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

Loading

@openjdk openjdk bot added the ready label Oct 29, 2021
@aivanov-jdk
Copy link
Member

@aivanov-jdk aivanov-jdk commented Oct 29, 2021

Sorry for my delayed review, looks good to me.

Loading

@mrserb
Copy link
Member Author

@mrserb mrserb commented Oct 30, 2021

/integrate

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Oct 30, 2021

Going to push as commit 6875678.
Since your change was applied there have been 231 commits pushed to the master branch:

  • 5bbc8d3: 8274621: NullPointerException because listenAddress[0] is null
  • 5021a12: 8274855: vectorapi tests failing with assert(!vbox->is_Phi()) failed
  • fe6a202: 8271356: Modify jdb to treat an empty command as a repeat of the previous command
  • cef9db9: 8276039: Remove unnecessary qualifications of java_lang_Class::
  • 13265f9: 8274750: java/io/File/GetXSpace.java failed: '/dev': 191488 != 190976
  • 5facaa2: 8276128: (bf) Remove unused constant ARRAY_BASE_OFFSET from Direct-X-Buffer
  • d6d82f5: 8275608: runtime/Metaspace/elastic/TestMetaspaceAllocationMT2 too slow
  • a1ec4f9: 6854300: [TEST_BUG] java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_3.java fails in jdk6u14 & jdk7
  • 8cc5950: 8251468: X509Certificate.get{Subject,Issuer}AlternativeNames and getExtendedKeyUsage do not throw CertificateParsingException if extension is unparseable
  • 4c3491b: 8017175: [TESTBUG] javax/swing/JPopupMenu/4634626/bug4634626.java sometimes failed on mac
  • ... and 221 more: https://git.openjdk.java.net/jdk/compare/b1b83500a9c3a74bf39894e49eefd031d208b9b9...master

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Oct 30, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 30, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Oct 30, 2021

@mrserb Pushed as commit 6875678.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Loading

@mrserb mrserb deleted the JDK-8273831 branch Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants