You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2026/09/26 12:18:21 UTC

(maven-resolver) branch master updated: fix: synchronize IPC stream access (#2163)

This is an automated email from the ASF dual-hosted git repository.

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a141f809 fix: synchronize IPC stream access (#2163)
7a141f809 is described below

commit 7a141f809326ddad64d36fa7e892c269bdd4f0e1
Author: Efe <go...@gmail.com>
AuthorDate: Sat Sep 26 15:18:15 2026 +0300

    fix: synchronize IPC stream access (#2163)
    
    ## Summary
    
    - Synchronize access to the IPC input and output streams with the existing client monitor.
    - Keep stream references consistent with `close()` while receiving and sending requests.
    
    Fixes #1991
    
    ## Testing
    
    - `mvn -pl maven-resolver-named-locks-ipc -am -DskipITs test` — passed with OpenJDK 21 (all selected modules; IPC module: 13 tests)
    - `mvn -pl maven-resolver-named-locks-ipc -DskipTests spotless:check` — passed with OpenJDK 21
    - `git diff --check` — passed
    
    AI assistance: Codex assisted with analysis, implementation, and validation. The change was reviewed locally and the submitted commit includes DCO sign-off.
    
    
    Assisted-by: Codex (GPT-5)
    
    Signed-off-by: Efe Gökdemir <ef...@rexcode.co.uk>
---
 .../main/java/org/eclipse/aether/named/ipc/IpcClient.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcClient.java b/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcClient.java
index bc2bee449..ebeaf8f4e 100644
--- a/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcClient.java
+++ b/maven-resolver-named-locks-ipc/src/main/java/org/eclipse/aether/named/ipc/IpcClient.java
@@ -127,6 +127,14 @@ public class IpcClient {
         }
     }
 
+    private synchronized DataInputStream getInput() {
+        return input;
+    }
+
+    private synchronized DataOutputStream getOutput() {
+        return output;
+    }
+
     SocketChannel createClient() throws IOException {
         SocketFamily family =
                 SocketFamily.valueOf(System.getProperty(IpcServer.SYSTEM_PROP_FAMILY, IpcServer.DEFAULT_FAMILY));
@@ -317,7 +325,7 @@ public class IpcClient {
     void receive() {
         try {
             while (true) {
-                DataInputStream in = input;
+                DataInputStream in = getInput();
                 if (in == null) {
                     throw new IOException("Connection closed");
                 }
@@ -346,7 +354,7 @@ public class IpcClient {
 
     List<String> send(List<String> request, long time, TimeUnit unit) throws TimeoutException, IOException {
         ensureInitialized();
-        DataOutputStream out = output;
+        DataOutputStream out = getOutput();
         if (out == null) {
             throw new IOException("Connection closed");
         }