Skip to content

Commit

Permalink
arthas-boot support unset JAVA_TOOL_OPTIONS. #2166
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Sep 4, 2022
1 parent 298e3db commit 60b3080
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE
}
}

try {
String javaToolOptions = System.getenv("JAVA_TOOL_OPTIONS");
if (javaToolOptions != null && !javaToolOptions.trim().isEmpty()) {
AnsiLog.info("JAVA_TOOL_OPTIONS: " + javaToolOptions);
}
} catch (Throwable e) {
// ignore
}

Bootstrap bootstrap = new Bootstrap();

CLI cli = CLIConfigurator.define(Bootstrap.class);
Expand Down
2 changes: 2 additions & 0 deletions boot/src/main/java/com/taobao/arthas/boot/ProcessUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ public static void startArthasCore(long targetPid, List<String> attachArgs) {
// -agent "${arthas_lib_dir}/arthas-agent.jar"

ProcessBuilder pb = new ProcessBuilder(command);
// https://github.com/alibaba/arthas/issues/2166
pb.environment().put("JAVA_TOOL_OPTIONS", "");
try {
final Process proc = pb.start();
Thread redirectStdout = new Thread(new Runnable() {
Expand Down

0 comments on commit 60b3080

Please sign in to comment.