You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses four open defects identified during the code audit:
#1988: In PutTaskRequestContent.java, change catch (Throwable t) to catch (Exception t) at lines 246 and 298. Catching Throwable trapped JVM fatal errors (OutOfMemoryError, StackOverflowError, LinkageError) and wrapped them into failed content chunks rather than letting them propagate for proper diagnostics.
#1989: In IpcServer.java, replace direct System.out / System.err console writes with standard SLF4J Logger (LOGGER.debug, LOGGER.info, LOGGER.error), ensuring server output integrates with standard logging configurations.
#1991: In IpcClient.java, synchronize retrieval and operations on volatile fields (output, input, socket) to prevent race conditions and NPEs when close() is invoked concurrently with active send() or receive().
#1995: In CollectResult.java, back exceptions and cycles collections with CopyOnWriteArrayList and add thread-safe accessors (setExceptions, setCycles), ensuring thread-safe access during multi-threaded dependency collection (such as in BfDependencyCollector).
Verification
mvn test -pl maven-resolver-transport-jetty,maven-resolver-named-locks-ipc,maven-resolver-api,maven-resolver-impl passed with 781 tests, 0 failures, 0 errors.
Dropped the [#1989] commit; the other three are unchanged. IpcAdapterIT and IpcAdapterNoForkIT were failing on every OS and JDK because of it.
IpcClient forks the daemon with a two-jar classpath built from getJarPath(getClass()) + getJarPath(IpcServer.class), both of which resolve to maven-resolver-named-locks-ipc itself. SLF4J is not on it, so the static LOGGER field failed during class initialisation in the forked JVM:
$ java -cp maven-resolver-named-locks-ipc/target/classes org.eclipse.aether.named.ipc.IpcServer
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.eclipse.aether.named.ipc.IpcServer.<clinit>(IpcServer.java:52)
The daemon died before it could connect back, the client's future.get(5, TimeUnit.SECONDS) expired, and every lock operation surfaced as RuntimeException: Unable to create new sync context.
#1989 is not reachable by adding the dependency either: the fork would also need an SLF4J binding, and without one the daemon logs nothing. System.out is the working channel here, since IpcClient already redirects the daemon's output to resolver-ipcsync-<id>.log via ProcessBuilder.Redirect. Reopening #1989 would need the classpath question settled first.
Verified: IpcAdapterIT 9 tests, 0 failures, 0 errors, where it was 5 failures and 4 errors before; full build 2055 tests, 0 failures, 0 errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR addresses four open defects identified during the code audit:
PutTaskRequestContent.java, changecatch (Throwable t)tocatch (Exception t)at lines 246 and 298. CatchingThrowabletrapped JVM fatal errors (OutOfMemoryError,StackOverflowError,LinkageError) and wrapped them into failed content chunks rather than letting them propagate for proper diagnostics.IpcServer.java, replace directSystem.out/System.errconsole writes with standard SLF4JLogger(LOGGER.debug,LOGGER.info,LOGGER.error), ensuring server output integrates with standard logging configurations.IpcClient.java, synchronize retrieval and operations on volatile fields (output,input,socket) to prevent race conditions and NPEs whenclose()is invoked concurrently with activesend()orreceive().CollectResult.java, backexceptionsandcyclescollections withCopyOnWriteArrayListand add thread-safe accessors (setExceptions,setCycles), ensuring thread-safe access during multi-threaded dependency collection (such as inBfDependencyCollector).Verification
mvn test -pl maven-resolver-transport-jetty,maven-resolver-named-locks-ipc,maven-resolver-api,maven-resolver-implpassed with 781 tests, 0 failures, 0 errors.This change was created with AI assistance.