arthas VM Option "PrintGC" is not writeable

tct7dpnv  于 2022-10-20  发布在  其他
关注(0)|答案(2)|浏览(128)
  • 我已经在 issues 里搜索,没有重复的issue。

环境信息

https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-vmoption

重现问题的步骤

  1. vmoption命令 3/3
  2. [arthas@147]$ vmoption PrintGC true
    Error during setting vm option: VM Option "PrintGC" is not writeable

期望的结果

$ vmoption PrintGC true
Successfully updated the vm option.
 NAME     BEFORE-VALUE  AFTER-VALUE
------------------------------------
 PrintGC  false         true

实际运行的结果

[arthas@147]$ vmoption PrintGC true
Error during setting vm option: VM Option "PrintGC" is not writeable

[arthas@147]$ vmoption PrintGC
 KEY                      VALUE                    ORIGIN                   WRITEABLE               
----------------------------------------------------------------------------------------------------
 PrintGC                  false                    DEFAULT                  false
rmbxnbpk

rmbxnbpk1#

有些版本的 jdk 的确不支持修改这个 PrintGC

可以试下:

vmoption HeapDumpPath '/tmp/test.bin'

vmoption HeapDumpAfterFullGC true

vmtool --action forceGc

然后检查是否生成了 /tmp/test.bin

zrfyljdw

zrfyljdw2#

这个是官网提供的在线练习里面的bug,练习和指引不一致。

$ java --version
openjdk 15-ea 2020-09-15
OpenJDK Runtime Environment (build 15-ea+8-219)
OpenJDK 64-Bit Server VM (build 15-ea+8-219, mixed mode, sharing)

相关问题