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

JDK-8284165: Add pid to process reaper thread name #8070

Closed

Conversation

tstuefe
Copy link
Member

@tstuefe tstuefe commented Apr 1, 2022

To help with analyzing fork-heavy scenarios, it would help if we could see at one glance which process a reaper is servicing. A pragmatic way would be to add the pid to its name - that way, e.g. thread dumps with lots of reaper threads would be more enlightening.

Since reaper threads get reused we have to change the name back to some base name when the reaper is done with the process. This has the additional benefit of showing us in the thread dump which reapers are actually reaping, and which are just idling around in the pool.

With this patch, reaper threads are:

  • named "reaper thread (pid: xxx)" when assigned to a process
  • remain named "reaper thread" without pid when not being assigned to a process.
thomas@starfish:/shared/projects/openjdk/jdk-jdk/source$ jcmd Test Thread.print | grep 'reaper'
"process reaper (pid 1358320)" #114 daemon prio=10 os_prio=0 cpu=4034,46ms elapsed=20,66s tid=0x00007f7860003ec0 nid=1277510 runnable  [0x00007f7944765000]
"process reaper" #105 daemon prio=10 os_prio=0 cpu=0,51ms elapsed=20,66s tid=0x00007f7900099e20 nid=1277511 waiting on condition  [0x00007f7944031000]
"process reaper" #102 daemon prio=10 os_prio=0 cpu=0,24ms elapsed=20,66s tid=0x00007f78b0003720 nid=1277512 waiting on condition  [0x00007f7869cca000]
"process reaper" #110 daemon prio=10 os_prio=0 cpu=0,39ms elapsed=20,66s tid=0x00007f78a8003260 nid=1277517 waiting on condition  [0x00007f7869c16000]
"process reaper" #106 daemon prio=10 os_prio=0 cpu=0,34ms elapsed=20,66s tid=0x00007f78480034a0 nid=1277518 waiting on condition  [0x00007f7869bf2000]
"process reaper (pid 1358355)" #118 daemon prio=10 os_prio=0 cpu=2762,03ms elapsed=20,66s tid=0x00007f78800042a0 nid=1277519 runnable  [0x00007f7869b8e000]
"process reaper" #119 daemon prio=10 os_prio=0 cpu=0,20ms elapsed=20,66s tid=0x00007f78a0013610 nid=1277520 waiting on condition  [0x00007f7869b6a000]
"process reaper (pid 1358365)" #97 daemon prio=10 os_prio=0 cpu=3608,37ms elapsed=20,66s tid=0x00007f78f4005b70 nid=1277521 runnable  [0x00007f7869bce000]
"process reaper (pid 1358388)" #95 daemon prio=10 os_prio=0 cpu=6079,07ms elapsed=20,66s tid=0x00007f7898003260 nid=1277522 runnable  [0x00007f7869b46000]
"process reaper" #86 daemon prio=10 os_prio=0 cpu=3897,96ms elapsed=20,66s tid=0x00007f7890003ce0 nid=1277523 waiting on condition  [0x00007f7869b22000]
"process reaper (pid 1358389)" #115 daemon prio=10 os_prio=0 cpu=5020,85ms elapsed=20,66s tid=0x00007f783c003840 nid=1277524 runnable  [0x00007f7869afe000]
"process reaper" #111 daemon prio=10 os_prio=0 cpu=4823,39ms elapsed=20,66s tid=0x00007f78fc111c20 nid=1277525 waiting on condition  [0x00007f7869ada000]
"process reaper" #91 daemon prio=10 os_prio=0 cpu=2566,21ms elapsed=20,66s tid=0x00007f78840042c0 nid=1277526 waiting on condition  [0x00007f7869ab6000]
"process reaper" #81 daemon prio=10 os_prio=0 cpu=2954,63ms elapsed=20,66s tid=0x00007f78c8003e90 nid=1277527 waiting on condition  [0x00007f7869a92000]
"process reaper" #121 daemon prio=10 os_prio=0 cpu=2966,19ms elapsed=20,66s tid=0x00007f789c003910 nid=1277528 waiting on condition  [0x00007f7869a6e000]

Tests:

  • I manually tested java/lang/Process* jtreg test groups, as well as java/util/concurrent/Phaser
  • GHAs
  • nightlies at SAP scheduled

Progress

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

Issue

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8070

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

Using diff file

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

@tstuefe tstuefe changed the title JDK-8284165-add-pid-to-reaper-name JDK-8284165: Add pid to process reaper thread name Apr 1, 2022
@bridgekeeper
Copy link

bridgekeeper bot commented Apr 1, 2022

👋 Welcome back stuefe! 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.

@openjdk
Copy link

openjdk bot commented Apr 1, 2022

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

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Apr 1, 2022
@tstuefe
Copy link
Member Author

tstuefe commented Apr 1, 2022

GHA: windows x64 error unrelated

@tstuefe tstuefe marked this pull request as ready for review April 1, 2022 11:37
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 1, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 1, 2022

Webrevs

Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

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

LGTM
A refactoring of the run method would be ok, but not essential.

@openjdk
Copy link

openjdk bot commented Apr 4, 2022

@tstuefe 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:

8284165: Add pid to process reaper thread name

Reviewed-by: rriggs

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 18 new commits pushed to the master branch:

  • 4e20a03: 8283044: Use asynchronous handshakes to deliver asynchronous exceptions
  • 9d200d6: 8282756: Make ElementKind checks more specific
  • 1012d59: 8281079: [s390] Unify Address Operand Encoding in Instruction Emitters
  • 003ec21: 8279508: Auto-vectorize Math.round API
  • c1e67b6: 8283474: Include detailed heap object info in CDS map file
  • 060a188: 8283865: riscv: Break down -XX:+UseRVB into seperate options for each bitmanip extension
  • e5e1aab: 8284068: riscv: should call Atomic::release_store in JavaThread::set_thread_state
  • 0b09f70: 8273553: sun.security.ssl.SSLEngineImpl.closeInbound also has similar error of JDK-8253368
  • afd0f5a: 8284190: disable G1RegionToSpaceMapper.largeStressAdjacent_vm on windows
  • 028fbf4: 8254935: Deprecate the PSSParameterSpec(int) constructor
  • ... and 8 more: https://git.openjdk.java.net/jdk/compare/bab431cc120fe09be371dadef0c1caf79ec9eef4...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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 4, 2022
@tstuefe
Copy link
Member Author

tstuefe commented Apr 5, 2022

Thanks @AlanBateman and @RogerRiggs !

/integrate

@openjdk
Copy link

openjdk bot commented Apr 5, 2022

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

  • 36b3bbc: 8284033: Leak XVisualInfo in getAllConfigs in awt_GraphicsEnv.c
  • 59fe31a: 8284170: Add "make doctor" to the make help
  • 9440b39: 8283215: [macos] Screen Magnifier: Getting java.awt.IllegalComponentStateException when menu item is selected
  • 86caf60: 8283703: Add sealed modifier to java.awt.geom.Path2D
  • 0cd46f6: 8283597: [REDO] Invalid generic signature for redefined classes
  • e297074: 8284181: ArgumentsTest.set_numeric_flag_double_vm fails on some locales
  • 732f7ae: 8284071: Collapse identical catch branches in jdk.console
  • 61d06c2: 8276050: XMLInputFactoryImpl.getProperty() returns null
  • 7381868: 8283623: Create an automated regression test for JDK-4525475
  • f76f5da: 5087440: java.io bulk read(...) end-of-stream return value descriptions ambiguous
  • ... and 19 more: https://git.openjdk.java.net/jdk/compare/bab431cc120fe09be371dadef0c1caf79ec9eef4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 5, 2022
@openjdk openjdk bot closed this Apr 5, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 5, 2022
@openjdk
Copy link

openjdk bot commented Apr 5, 2022

@tstuefe Pushed as commit 9561b5e.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
3 participants