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

JVM hangs at safepoint synchronization when profiling some large applications #70

Open
AlexVanGogen opened this issue Aug 18, 2020 · 1 comment · May be fixed by #74
Open

JVM hangs at safepoint synchronization when profiling some large applications #70

AlexVanGogen opened this issue Aug 18, 2020 · 1 comment · May be fixed by #74

Comments

@AlexVanGogen
Copy link
Contributor

Sometimes I get the following thread states:

  • profiler thread blocks at safepoint when executing jvmti->GetLineNumberTable and holding frame_lock;
  • one user thread in signal handling holds in_scope_lock and spins on acquiring frame_lock;
  • some other user threads in signal thread spin on acquiring in_scope_lock.

According to gdb, user threads were interrupted while being already blocked at safepoint, and these threads are unable to block once more. Running application with -XX:+SafepointTimeout and other related flags agrees with gdb and reports that the same user threads which spin in signal handler cannot reach safepoint.

Tightening critical section in profiler code so that it enters section only to work with static_call_frames fixes this problem, but not entirely I guess -- this just harshly reduces the chance of its occurrence.

@Byte-Lab
Copy link
Owner

It's odd that we're stuck at jvmti->GetLineNumberTable, but I'm pretty sure (as you said on gitter), we don't need to be holding frame_lock past the for loop at https://github.com/Decave/JCoz/blob/master/src/native/profiler.cc#L385. frame_lock really just needs to protect static_call_frames, which is used to collect call frames in the user threads when an experiment isn't running.

AlexVanGogen added a commit to AlexVanGogen/JCoz that referenced this issue Aug 19, 2020
AlexVanGogen added a commit to AlexVanGogen/JCoz that referenced this issue Aug 19, 2020
@AlexVanGogen AlexVanGogen linked a pull request Aug 19, 2020 that will close this issue
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 a pull request may close this issue.

2 participants