Skip to content

VMStructs was changed in JDK 20 - need to adjust#10

Merged
jbachorik merged 1 commit into
mainfrom
jb/check_jmethodID
Aug 23, 2023
Merged

VMStructs was changed in JDK 20 - need to adjust#10
jbachorik merged 1 commit into
mainfrom
jb/check_jmethodID

Conversation

@jbachorik
Copy link
Copy Markdown
Collaborator

The check_jmethodID function was basically ignored on JDK 20 because the vmstructs layout has changed.
This fix is addressing the change.

@github-actions
Copy link
Copy Markdown
Contributor

🔧 Report generated by pr-comment-scanbuild

Scan-Build Report

User:runner@fv-az1420-116
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 clean all
Clang Version:Ubuntu clang version 14.0.0-1ubuntu1.1
Date:Wed Aug 23 13:52:52 2023

Bug Summary

Bug TypeQuantityDisplay?
All Bugs5
Logic error
Assigned value is garbage or undefined1
Dereference of null pointer2
Result of operation is garbage or undefined1
Unused code
Dead nested assignment1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Logic errorAssigned value is garbage or undefineddwarf.cppparseInstructions23120
Unused codeDead nested assignmentvmStructs.cppcheckNativeBinding6491
Logic errorDereference of null pointersafeAccess.hload3512
Logic errorDereference of null pointersymbols_linux.cppElfParser15435
Logic errorResult of operation is garbage or undefineddwarf.hgetSLeb12325

@github-actions
Copy link
Copy Markdown
Contributor

🔧 Report generated by pr-comment-cppcheck

CppCheck Report

Style Violations (151)

@jbachorik jbachorik marked this pull request as draft August 23, 2023 13:59
@jbachorik jbachorik marked this pull request as ready for review August 23, 2023 14:12
@jbachorik
Copy link
Copy Markdown
Collaborator Author

/merge

@dd-devflow
Copy link
Copy Markdown

dd-devflow Bot commented Aug 23, 2023

🚂 MergeQueue

Pull request added to the queue.

This build is going to start soon! (estimated merge in less than 0s)

you can cancel this operation by commenting your pull request with /merge -c!

@jbachorik
Copy link
Copy Markdown
Collaborator Author

/remove

@jbachorik jbachorik merged commit b419969 into main Aug 23, 2023
@jbachorik jbachorik deleted the jb/check_jmethodID branch August 23, 2023 15:18
@dd-devflow
Copy link
Copy Markdown

dd-devflow Bot commented Aug 23, 2023

⚠️ MergeQueue

This merge request build was cancelled after being merged manually

If you need support, contact us on slack #ci-interfaces!

jbachorik added a commit that referenced this pull request May 25, 2026
The always-on _in_signal_handler_depth TLS variable, accessed first from
inside our SIGPROF/SIGVTALRM handlers via SIGNAL_HANDLER_GUARD(), was
declared with the default global-dynamic TLS model.  On first access in
a given thread glibc lazily allocates the dtv slot via malloc() and
takes the heap lock — both async-signal-unsafe.

Reproduced deterministically on Graal aarch64 (glibc 17-graal debug)
running ClassGCTest: SIGPROF arrived on the VM Thread while Graal's
JVMCI compiler held the malloc heap lock through
c2v_notifyCompilerPhaseEvent.  Stack:

  #2  __libc_malloc                    -- waiting on heap lock
  #4  allocate_dtv_entry
  #7  _dl_tlsdesc_dynamic
  #8  TLS wrapper for _in_signal_handler_depth
  #9  SignalHandlerScope::SignalHandlerScope
  #10 CTimer::signalHandler

The heap holder is itself blocked at a safepoint waiting for VM Thread
to check in, and VM Thread is stuck in malloc -> full process deadlock.

Switch the variable to the initial-exec TLS model so the loader
allocates its slot from the static TLS surplus at libjavaProfiler.so
load time.  Every existing thread is fixed up at dlopen and every new
thread receives the slot at pthread_create.  Access is then a
register-relative load — async-signal-safe, lock-free, malloc-free.

Also narrow the type to uint8_t (realistic max depth ~3) to make the
intent explicit; alignment-wise this is the same slot.

Refresher tick reduced from 5 s to 500 ms so a library lazily loaded
from signal context becomes resolvable by the stack walker within
half a second.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants