From 55912d58e4028c8e8f72b64ff335d27656446d71 Mon Sep 17 00:00:00 2001 From: Jacek Date: Tue, 14 Dec 2021 14:57:10 +0100 Subject: SONAR-15840 Fix SSF-219 --- .../main/java/org/sonar/application/command/CommandFactoryImpl.java | 3 ++- .../src/main/java/org/sonar/application/command/EsJvmOptions.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'server/sonar-main/src/main/java') 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 { private static Map mandatoryOptions(File tmpDir, Props props) { Map 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 { /** * JVM options from class "org.elasticsearch.tools.launchers.SystemJvmOptions" */ - private static void fromSystemJvmOptionsClass(Map res) { + private static void fromSystemJvmOptionsClass(File tmpDir, Map 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 { 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. -- cgit v1.2.3