diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2021-12-14 14:57:10 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-12-17 12:06:46 +0000 |
commit | 55912d58e4028c8e8f72b64ff335d27656446d71 (patch) | |
tree | 59e47bc2c9c4e26bbbdb2ee671ff3ac0783a6865 /server/sonar-main/src | |
parent | 437b7fcd2357ada2f9b8968403f0cdcaba6d2390 (diff) | |
download | sonarqube-55912d58e4028c8e8f72b64ff335d27656446d71.tar.gz sonarqube-55912d58e4028c8e8f72b64ff335d27656446d71.zip |
SONAR-15840 Fix SSF-219
Diffstat (limited to 'server/sonar-main/src')
3 files changed, 7 insertions, 3 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java b/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java index 5b89acf18ce..4508eee5212 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java @@ -34,6 +34,7 @@ import org.sonar.process.ProcessProperties; import org.sonar.process.Props; import org.sonar.process.System2; +import static org.sonar.process.ProcessProperties.parseTimeoutMs; import static org.sonar.process.ProcessProperties.Property.CE_GRACEFUL_STOP_TIMEOUT; import static org.sonar.process.ProcessProperties.Property.CE_JAVA_ADDITIONAL_OPTS; import static org.sonar.process.ProcessProperties.Property.CE_JAVA_OPTS; @@ -53,7 +54,6 @@ import static org.sonar.process.ProcessProperties.Property.SOCKS_PROXY_PORT; import static org.sonar.process.ProcessProperties.Property.WEB_GRACEFUL_STOP_TIMEOUT; import static org.sonar.process.ProcessProperties.Property.WEB_JAVA_ADDITIONAL_OPTS; import static org.sonar.process.ProcessProperties.Property.WEB_JAVA_OPTS; -import static org.sonar.process.ProcessProperties.parseTimeoutMs; public class CommandFactoryImpl implements CommandFactory { private static final String ENV_VAR_JAVA_TOOL_OPTIONS = "JAVA_TOOL_OPTIONS"; @@ -110,6 +110,7 @@ public class CommandFactoryImpl implements CommandFactory { .setEnvVariable("ES_PATH_CONF", esInstallation.getConfDirectory().getAbsolutePath()) .setEnvVariable("ES_JVM_OPTIONS", esInstallation.getJvmOptions().getAbsolutePath()) .setEnvVariable("ES_JAVA_HOME", System.getProperties().getProperty("java.home")) + .setEnvVariable("LIBFFI_TMPDIR", this.tempDir.getAbsolutePath()) .suppressEnvVariable(ENV_VAR_JAVA_TOOL_OPTIONS) .suppressEnvVariable(ENV_VAR_ES_JAVA_OPTS); } diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java index 09ac20a2199..5bb7aaafd2e 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/EsJvmOptions.java @@ -44,7 +44,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> { private static Map<String, String> mandatoryOptions(File tmpDir, Props props) { Map<String, String> res = new LinkedHashMap<>(30); fromJvmDotOptionsFile(tmpDir, res); - fromSystemJvmOptionsClass(res); + fromSystemJvmOptionsClass(tmpDir, res); if (!props.value("sonar.jdbc.url", "").contains("jdbc:h2") && !props.valueAsBoolean("sonar.es.bootstrap.checks.disable")) { res.put("-Des.enforce.bootstrap.checks=", "true"); @@ -76,7 +76,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> { /** * JVM options from class "org.elasticsearch.tools.launchers.SystemJvmOptions" */ - private static void fromSystemJvmOptionsClass(Map<String, String> res) { + private static void fromSystemJvmOptionsClass(File tmpDir, Map<String, String> res) { /* * Cache ttl in seconds for positive DNS lookups noting that this overrides the JDK security property networkaddress.cache.ttl; * can be set to -1 to cache forever. @@ -97,6 +97,7 @@ public class EsJvmOptions extends JvmOptions<EsJvmOptions> { res.put("-Dfile.encoding=", "UTF-8"); // use our provided JNA always versus the system one res.put("-Djna.nosys=", "true"); + res.put("-Djna.tmpdir=", tmpDir.getAbsolutePath()); /* * Turn off a JDK optimization that throws away stack traces for common exceptions because stack traces are important for * debugging. diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java index 5740f761456..fe9cc2b40ab 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/EsJvmOptionsTest.java @@ -57,6 +57,7 @@ public class EsJvmOptionsTest { "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djna.nosys=true", + "-Djna.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:-OmitStackTraceInFastThrow", "-Dio.netty.noUnsafe=true", "-Dio.netty.noKeySetOptimization=true", @@ -140,6 +141,7 @@ public class EsJvmOptionsTest { "-Djava.awt.headless=true\n" + "-Dfile.encoding=UTF-8\n" + "-Djna.nosys=true\n" + + "-Djna.tmpdir=" + tmpDir.getAbsolutePath() + "\n" + "-XX:-OmitStackTraceInFastThrow\n" + "-Dio.netty.noUnsafe=true\n" + "-Dio.netty.noKeySetOptimization=true\n" + |