1

I cannot find a way to set JFR stack depth at runtime. I'm using OpenJDK 11.

jcmd <pid> JFR.configure stackdepth=128 seems to have no effect.

After executing the command I correctly see this message :

D:\>jcmd 8848 JFR.configure stackdepth=128
8848:
Stack depth: 128

But following recordings stackdepth desperately stays at 64.

I tried executing the command after and before the recordings are started through JFR.start. Neither works...

Olivier Masseau
  • 778
  • 7
  • 23
  • 1
    What occurrs to me is that maybe that particular JVM parameter can't be changed except when first launching the application. I could not find much to back this up. I did find just one bit of evidence to suggest that this might be the case: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009550939-How-do-you-change-the-stack-depth-size-when-attaching-the-Java-profiler-to-a-running-process-. As I could find no other support for this idea, and this post is two years old and suggests it is talking about a bug, maybe this doesn't apply at all to your situation. – CryptoFool Aug 13 '22 at 19:41
  • 1
    Could you try using a newer version of the JDK, at least to try to diagnose this problem? Maybe this is a limitation of JDK 11 that has since been removed. That might explain the post I reference above, as JDK 11 is nearly 4 years old. Just spitballing here. – CryptoFool Aug 13 '22 at 19:44

1 Answers1

0

The stack depth can't be changed after a recording has been started.

Kire Haglin
  • 6,569
  • 22
  • 27
  • A reference would be nice. I couldn't find one, so I'd be interested to see where this is explicitly stated in the JDK docs or has otherwise been definitively stated or determined. I'm particularly interested in if this limitation has been removed from newer versions of the JDK. – CryptoFool Aug 13 '22 at 21:38
  • Once the thread local memory for a stack trace has been allocated it can't be reallocated.https://github.com/openjdk/jdk11u-dev/blob/74daa996b5212deddc19c806b07f7f1f924ce1e6/src/hotspot/share/jfr/support/jfrThreadLocal.hpp#L110 https://github.com/openjdk/jdk11u-dev/blob/74daa996b5212deddc19c806b07f7f1f924ce1e6/src/hotspot/share/jfr/support/jfrThreadLocal.cpp#L161 – Kire Haglin Aug 13 '22 at 21:41
  • The limitation has not been removed. – Kire Haglin Aug 13 '22 at 21:49
  • The thing is that I tried also changing it before starting the recording and it had no effect ;) – Olivier Masseau Aug 15 '22 at 00:49
  • The functionality is not well tested, so there could be bugs. https://github.com/openjdk/jdk19u/blob/master/test/jdk/jdk/jfr/jcmd/TestJcmdConfigure.java – Kire Haglin Aug 15 '22 at 08:33