This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git
The following commit(s) were added to refs/heads/master by this push:
new 1f99fb8c Run client connection handler inside new thread, fixes #798
(#801)
1f99fb8c is described below
commit 1f99fb8cb7e5815986c24b3d33e81532b67374a5
Author: Petr Široký <[email protected]>
AuthorDate: Tue Mar 7 14:16:04 2023 +0100
Run client connection handler inside new thread, fixes #798 (#801)
* Run client connection handler inside new thread, fixes #798
* Execute CI build on ubuntu-22.04
* ubuntu-18.04 image is now deprecated and there are brownout periods
being introduced where the builds are failing
* see https://github.com/actions/runner-images/issues/6002 for more
details
---
.github/workflows/early-access.yaml | 2 +-
daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/early-access.yaml
b/.github/workflows/early-access.yaml
index f92aa35c..e8df8b51 100644
--- a/.github/workflows/early-access.yaml
+++ b/.github/workflows/early-access.yaml
@@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ ubuntu-18.04, macOS-10.15, windows-2019 ]
+ os: [ ubuntu-22.04, macOS-10.15, windows-2019 ]
runs-on: ${{ matrix.os }}
steps:
diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
index f416b5de..a10502f0 100644
--- a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
+++ b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/Server.java
@@ -239,7 +239,16 @@ public class Server implements AutoCloseable, Runnable {
try {
while (true) {
try (SocketChannel socket = this.socket.accept()) {
- client(socket);
+ try {
+ // execute the client connection handling inside a new
thread to guard against possible
+ // ThreadLocal memory leaks
+ // see https://github.com/apache/maven-mvnd/issues/798
for more details
+ Thread handler = new Thread(() -> client(socket));
+ handler.start();
+ handler.join();
+ } catch (Throwable t) {
+ LOGGER.error("Error handling a client connection", t);
+ }
}
}
} catch (Throwable t) {
@@ -270,7 +279,7 @@ public class Server implements AutoCloseable, Runnable {
updateState(DaemonState.Idle);
return;
}
- LOGGER.info("Request received: " + message);
+ LOGGER.info("Request received: {}", message);
if (message instanceof BuildRequest) {
handle(connection, (BuildRequest) message);
}