RFR: JDK-8306510: Print number of threads and stack sizes in error reports [v4]
Gerard Ziemski
gziemski at openjdk.org
Fri Apr 28 16:03:25 UTC 2023
On Fri, 28 Apr 2023 06:25:57 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> To analyze OOM situations, the number of threads and their stack sizes are useful. NMT tells us, but NMT may be disabled.
>>
>> We already print threads and stacks. Today one could count lines and calculate stack sizes via stack base and end address. But that can get old real quick. It would be helpful to see the number of threads and their stack sizes printed out.
>>
>> ---------
>>
>> Patch does that, and also adjusts indentation a bit to make the output more readable. I'm open to leaving out that part if folks object. The patch only affects printing hs-err files, no other printouts should be affected (I tested jcmd Thread.print and output is unchanged).
>>
>> Tests: manually ran runtime/ErrorHandling and serviceability/dcmd on Linux x64 and x32.
>>
>> Changed output looks like this:
>>
>> before:
>>
>> Java Threads: ( => current thread )
>> =>0x00007fe26c028d50 JavaThread "main" [_thread_in_vm, id=229773, stack(0x00007fe270f4e000,0x00007fe27104f000)]
>> 0x00007fe26c30bca0 JavaThread "Reference Handler" daemon [_thread_blocked, id=229780, stack(0x00007fe2309fc000,0x00007fe230afd000)]
>> 0x00007fe26c30d670 JavaThread "Finalizer" daemon [_thread_blocked, id=229781, stack(0x00007fe2308fb000,0x00007fe2309fc000)]
>> 0x00007fe26c3178b0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=229782, stack(0x00007fe2307fa000,0x00007fe2308fb000)]
>> 0x00007fe26c319030 JavaThread "Service Thread" daemon [_thread_blocked, id=229783, stack(0x00007fe2306f9000,0x00007fe2307fa000)]
>> 0x00007fe26c31a710 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=229784, stack(0x00007fe2305f8000,0x00007fe2306f9000)]
>> 0x00007fe26c31c480 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=229785, stack(0x00007fe2304f7000,0x00007fe2305f8000)]
>> 0x00007fe26c31dd10 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=229786, stack(0x00007fe2303f6000,0x00007fe2304f7000)]
>> 0x00007fe20007aa70 JavaThread "C1 CompilerThread1" daemon [_thread_blocked, id=229787, stack(0x00007fe230215000,0x00007fe230316000)]
>> 0x00007fe20011b4d0 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=229788, stack(0x00007fe230114000,0x00007fe230215000)]
>> 0x00007fe20011c880 JavaThread "C1 CompilerThread3" daemon [_thread_blocked, id=229789, stack(0x00007fe230013000,0x00007fe230114000)]
>> 0x00007fe26c432530 JavaThread "Notification Thread" daemon [_thread_blocked, id=229790, stack(0x00007fe1f7eff000,0x00007fe1f8000000)]
>>
>> Other Threads:
>> 0x00007fe26c290f00 VMThread "VM Thread" [stack: 0x00007fe23106f000,0x00007fe23116f000] [id=229779]
>> 0x00007fe26c434920 WatcherThread "VM Periodic Task Thread" [stack: 0x00007fe1f7dff000,0x00007fe1f7eff000] [id=229791]
>> 0x00007fe26c05aeb0 WorkerThread "GC Thread#0" [stack: 0x00007fe2408ac000,0x00007fe2409ac000] [id=229774]
>> 0x00007fe26c06c320 ConcurrentGCThread "G1 Main Marker" [stack: 0x00007fe2407aa000,0x00007fe2408aa000] [id=229775]
>> 0x00007fe26c06d490 WorkerThread "G1 Conc#0" [stack: 0x00007fe2406a8000,0x00007fe2407a8000] [id=229776]
>> 0x00007fe26c12eae0 ConcurrentGCThread "G1 Refine#0" [stack: 0x00007fe2312f4000,0x00007fe2313f4000] [id=229777]
>> 0x00007fe26c12fc40 ConcurrentGCThread "G1 Service" [stack: 0x00007fe2311f2000,0x00007fe2312f2000] [id=229778]
>>
>> now:
>>
>>
>> Java Threads: ( => current thread )
>> =>0x00007f0ac4028d50 JavaThread "main" [_thread_in_vm, id=239089, stack(0x00007f0aca01d000,0x00007f0aca11e000) (1028K)]
>> 0x00007f0ac430bca0 JavaThread "Reference Handler" daemon [_thread_blocked, id=239096, stack(0x00007f0a9803e000,0x00007f0a9813f000) (1028K)]
>> 0x00007f0ac430d670 JavaThread "Finalizer" daemon [_thread_blocked, id=239097, stack(0x00007f0a8998f000,0x00007f0a89a90000) (1028K)]
>> 0x00007f0ac43178b0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=239098, stack(0x00007f0a8988e000,0x00007f0a8998f000) (1028K)]
>> 0x00007f0ac4319030 JavaThread "Service Thread" daemon [_thread_blocked, id=239099, stack(0x00007f0a8978d000,0x00007f0a8988e000) (1028K)]
>> 0x00007f0ac431a710 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=239100, stack(0x00007f0a8968c000,0x00007f0a8978d000) (1028K)]
>> 0x00007f0ac431c480 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=239101, stack(0x00007f0a8958b000,0x00007f0a8968c000) (1028K)]
>> 0x00007f0ac431dd10 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=239102, stack(0x00007f0a8948a000,0x00007f0a8958b000) (1028K)]
>> 0x00007f0a5808da10 JavaThread "C1 CompilerThread1" daemon [_thread_blocked, id=239103, stack(0x00007f0a892b9000,0x00007f0a893ba000) (1028K)]
>> 0x00007f0a5811e450 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=239104, stack(0x00007f0a891b8000,0x00007f0a892b9000) (1028K)]
>> 0x00007f0a5811f800 JavaThread "C1 CompilerThread3" daemon [_thread_blocked, id=239105, stack(0x00007f0a890b7000,0x00007f0a891b8000) (1028K)]
>> 0x00007f0ac443a4b0 JavaThread "Notification Thread" daemon [_thread_blocked, id=239106, stack(0x00007f0a88fb6000,0x00007f0a890b7000) (1028K)]
>> Total: 12
>>
>> Other Threads:
>> 0x00007f0ac4290f00 VMThread "VM Thread" [stack: 0x00007f0a98141000,0x00007f0a98241000] (1024K) [id=239095]
>> 0x00007f0ac443c8a0 WatcherThread "VM Periodic Task Thread" [stack: 0x00007f0a88eb6000,0x00007f0a88fb6000] (1024K) [id=239107]
>> 0x00007f0ac405aeb0 WorkerThread "GC Thread#0" [stack: 0x00007f0ac8929000,0x00007f0ac8a29000] (1024K) [id=239090]
>> 0x00007f0ac406c320 ConcurrentGCThread "G1 Main Marker" [stack: 0x00007f0ac8827000,0x00007f0ac8927000] (1024K) [id=239091]
>> 0x00007f0ac406d490 WorkerThread "G1 Conc#0" [stack: 0x00007f0ac8725000,0x00007f0ac8825000] (1024K) [id=239092]
>> 0x00007f0ac412eae0 ConcurrentGCThread "G1 Refine#0" [stack: 0x00007f0a98462000,0x00007f0a98562000] (1024K) [id=239093]
>> 0x00007f0ac412fc40 ConcurrentGCThread "G1 Service" [stack: 0x00007f0a98360000,0x00007f0a98460000] (1024K) [id=239094]
>> Total: 8
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
>
> - merge
> - davids comments
> - feedback
> - Merge branch 'openjdk:master' into JDK-8306510-Print-number-of-threads-and-stack-sizes-in-error-reports
> - start
> - JDK-8306510-Print-number-of-threads-and-stack-sizes-in-error-reports
> > I still see a difference in how we report the thread info:
> > ```
> > Java Threads: ( => current thread ):
> > 0x00007f0ac443a4b0 JavaThread "Notification Thread" daemon [_thread_blocked, id=239106, stack(0x00007f0a88fb6000,0x00007f0a890b7000) (1028K)]
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > vs
> > ```
> > Other Threads:
> > 0x00007f0ac4290f00 VMThread "VM Thread" [stack: 0x00007f0a98141000,0x00007f0a98241000] (1024K) [id=239095]
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Did you decide not to pursue it?
>
> I did though
>
> [b109cba](https://github.com/openjdk/jdk/commit/b109cba11ed420a7f1bc4c05d25a43f6905b8113)
>
> ```
> 163 Java Threads: ( => current thread )
> 164 =>0x00007f9328028d10 JavaThread "main" [_thread_in_vm, id=104806, stack(0x00007f932fdf0000,0x00007f932fef1000) (1028K)]
> 165 0x00007f932826dce0 JavaThread "Reference Handler" daemon [_thread_blocked, id=104813, stack(0x00007f92e780d000,0x00007f92e790e000) (1028K)]
> 166 0x00007f932826f4c0 JavaThread "Finalizer" daemon [_thread_blocked, id=104814, stack(0x00007f92e770c000,0x00007f92e780d000) (1028K)]
> 167 0x00007f9328271300 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=104815, stack(0x00007f92e760b000,0x00007f92e770c000) (1028K)]
> 168 0x00007f9328272b20 JavaThread "Service Thread" daemon [_thread_blocked, id=104816, stack(0x00007f92e750a000,0x00007f92e760b000) (1028K)]
> 169 0x00007f9328274200 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=104817, stack(0x00007f92e7409000,0x00007f92e750a000) (1028K)]
> 170 0x00007f9328275ef0 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=104818, stack(0x00007f92e7308000,0x00007f92e7409000) (1028K)]
> 171 0x00007f9328277780 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=104819, stack(0x00007f92e7207000,0x00007f92e7308000) (1028K)]
> 172 0x00007f932829f370 JavaThread "Notification Thread" daemon [_thread_blocked, id=104820, stack(0x00007f92e7036000,0x00007f92e7137000) (1028K)]
> 173 Total: 9
> 174
> 175 Other Threads:
> 176 0x00007f932822a3e0 VMThread "VM Thread" [id=104812, stack:(0x00007f92e7e7f000,0x00007f92e7f7f000) (1024K)]
> 177 0x00007f93282a1380 WatcherThread "VM Periodic Task Thread" [id=104821, stack:(0x00007f92e2f00000,0x00007f92e3000000) (1024K)]
> 178 0x00007f932805add0 WorkerThread "GC Thread#0" [id=104807, stack:(0x00007f932c79c000,0x00007f932c89c000) (1024K)]
> 179 0x00007f932806c240 ConcurrentGCThread "G1 Main Marker" [id=104808, stack:(0x00007f932c69b000,0x00007f932c79b000) (1024K)]
> 180 0x00007f932806d3b0 WorkerThread "G1 Conc#0" [id=104809, stack:(0x00007f932c59a000,0x00007f932c69a000) (1024K)]
> 181 0x00007f932812ea00 ConcurrentGCThread "G1 Refine#0" [id=104810, stack:(0x00007f92fc1a6000,0x00007f92fc2a6000) (1024K)]
> 182 0x00007f932812fb60 ConcurrentGCThread "G1 Service" [id=104811, stack:(0x00007f92fc0a5000,0x00007f92fc1a5000) (1024K)]
> 183 Total: 7
> ```
>
> You sure you looked at the latest version?
Looks like we still have just one character difference:
`id=104819, stack(0x00007f92e7207000,0x00007f92e7308000)
`
vs
`id=104812, stack:(0x00007f92e7e7f000,0x00007f92e7f7f000)
`
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13556#issuecomment-1527762134
More information about the hotspot-runtime-dev
mailing list