From f13e39402f06afb68e0e79a5e6dcc08a0d84b818 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Tue, 21 May 2024 09:57:59 +0200 Subject: [PATCH] improve diagnostics and robustness around unknown requests to CompilerDaemon --- ci/common.jsonnet | 4 +++- common.json | 17 +++++++++-------- .../mxtool/compilerserver/CompilerDaemon.java | 18 +++++++++++------- src/mx/_impl/mx.py | 2 +- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ci/common.jsonnet b/ci/common.jsonnet index e06f7059..9de7cac0 100644 --- a/ci/common.jsonnet +++ b/ci/common.jsonnet @@ -60,6 +60,8 @@ local common_json = import "../common.json"; } + { [name]: jdk_base + common_json.jdks[name] + { jdk_version:: parse_labsjdk_version(self), jdk_name:: "jdk-latest"} for name in ["oraclejdk-latest"] + variants("labsjdk-ce-latest") + variants("labsjdk-ee-latest") + } + { + 'graalvm-ee-21': jdk_base + common_json.jdks["graalvm-ee-21"] + { jdk_version:: 21 }, }, # We do not want to expose galahad-jdk assert std.assertEqual([x for x in std.objectFields(common_json.jdks) if x != "galahad-jdk"], std.objectFields(jdks_data)), @@ -329,7 +331,7 @@ local common_json = import "../common.json"; }, opt_post_merge: { targets+: ["opt-post-merge"], - tags+: [] + tags+: {opt_post_merge +: []}, }, daily: { targets+: ["daily"], diff --git a/common.json b/common.json index 816115df..369e9048 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "7.22.7", + "mx_version": "7.25.0", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { @@ -43,14 +43,15 @@ "labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33", "platformspecific": true }, "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-debug", "platformspecific": true }, "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-sulong", "platformspecific": true }, + "graalvm-ee-21": {"name": "graalvm-java21", "version": "23.1.3", "platformspecific": true }, - "oraclejdk-latest": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+21", "platformspecific": true, "extrabundles": ["static-libs"]}, - "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-23+21-jvmci-b01", "platformspecific": true }, - "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-23+21-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-23+21-jvmci-b01-sulong", "platformspecific": true }, - "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-23+21-jvmci-b01", "platformspecific": true }, - "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-23+21-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-23+21-jvmci-b01-sulong", "platformspecific": true } + "oraclejdk-latest": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+22", "platformspecific": true, "extrabundles": ["static-libs"]}, + "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-23+22-jvmci-b01", "platformspecific": true }, + "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-23+22-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-23+22-jvmci-b01-sulong", "platformspecific": true }, + "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-23+22-jvmci-b01", "platformspecific": true }, + "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-23+22-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-23+22-jvmci-b01-sulong", "platformspecific": true } }, "eclipse": { diff --git a/java/com.oracle.mxtool.compilerserver/src/com/oracle/mxtool/compilerserver/CompilerDaemon.java b/java/com.oracle.mxtool.compilerserver/src/com/oracle/mxtool/compilerserver/CompilerDaemon.java index 501d9ff7..722fc913 100644 --- a/java/com.oracle.mxtool.compilerserver/src/com/oracle/mxtool/compilerserver/CompilerDaemon.java +++ b/java/com.oracle.mxtool.compilerserver/src/com/oracle/mxtool/compilerserver/CompilerDaemon.java @@ -30,6 +30,7 @@ import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; +import java.time.Instant; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; @@ -45,7 +46,7 @@ public abstract class CompilerDaemon { /** * The deamon will shut down after receiving this many requests with an unrecognized header. */ - static final int MAX_UNRECOGNIZED_REQUESTS = 5; + static final int MAX_UNRECOGNIZED_REQUESTS = 1000; protected void logf(String format, Object... args) { if (verbose) { @@ -127,6 +128,7 @@ public Connection(Socket connectionSocket, Compiler compiler) { this.compiler = compiler; } + @Override public void run() { try { BufferedReader input = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream(), "UTF-8")); @@ -134,8 +136,10 @@ public void run() { try { String request = input.readLine(); + String requestOrigin = connectionSocket.getInetAddress().getHostAddress(); + String prefix = String.format("[%s:%s] ", Instant.now(), requestOrigin); if (request == null || request.equals(REQUEST_HEADER_SHUTDOWN)) { - logf("Shutting down%n"); + logf("%sShutting down%n", prefix); running = false; while (threadPool.getActiveCount() > 1) { threadPool.awaitTermination(50, TimeUnit.MILLISECONDS); @@ -146,21 +150,21 @@ public void run() { } else if (request.startsWith(REQUEST_HEADER_COMPILE)) { String commandLine = request.substring(REQUEST_HEADER_COMPILE.length()); String[] args = commandLine.split("\u0000"); - logf("Compiling %s%n", String.join(" ", args)); + logf("%sCompiling %s%n", prefix, String.join(" ", args)); int result = compiler.compile(args); if (result != 0 && args.length != 0 && args[0].startsWith("GET / HTTP")) { // GR-52712 - System.err.printf("Failing compilation received on %s%n", connectionSocket); + System.err.printf("%sFailing compilation received on %s%n", prefix, connectionSocket); } - logf("Result = %d%n", result); + logf("%sResult = %d%n", prefix, result); output.write(result + "\n"); } else { - System.err.printf("Unrecognized request (len=%d): \"%s\"%n", request.length(), request); + System.err.printf("%sUnrecognized request (len=%d): \"%s\"%n", prefix, request.length(), request); int unrecognizedRequestCount = unrecognizedRequests.incrementAndGet(); if (unrecognizedRequestCount > MAX_UNRECOGNIZED_REQUESTS) { - System.err.printf("Shutting down after receiving %d unrecognized requests%n", unrecognizedRequestCount); + System.err.printf("%sShutting down after receiving %d unrecognized requests%n", prefix, unrecognizedRequestCount); System.exit(0); } output.write("-1\n"); diff --git a/src/mx/_impl/mx.py b/src/mx/_impl/mx.py index 3269343d..aff051f3 100755 --- a/src/mx/_impl/mx.py +++ b/src/mx/_impl/mx.py @@ -18173,7 +18173,7 @@ def alarm_handler(signum, frame): _CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache')) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("7.25.3") # GR-704 Remove --vm and --vmbuild flags +version = VersionSpec("7.25.4") # GR-54113 _mx_start_datetime = datetime.utcnow()