Skip to content

Fix #1994: log exceptions from IpcNamedLock.tryUnlock() - #2045

Merged
elharo merged 3 commits into
masterfrom
fix-1994-ipc-named-lock-unlock-log
Aug 9, 2026
Merged

elharo merged 3 commits into
masterfrom
fix-1994-ipc-named-lock-unlock-log

Conversation

@elharo

@elharo elharo commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #1994

IpcNamedLock.tryUnlock() was silently discarding all exceptions from client.unlock() during timeout cleanup, masking real IO/connectivity issues.

Fix: log the failure at WARN level instead of swallowing it. The exception is still not propagated, preserving the best-effort cleanup semantics that must not crash the calling thread.

Test: added IpcNamedLockTest.unlockFailureDuringTimeoutCleanupIsLogged, which mocks IpcClient so that lock() times out and unlock() throws, then asserts the unlock failure is logged. The test fails against the old code (no log output) and passes with the fix.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, minimal fix that adds WARN-level logging for a previously silent exception catch in IpcNamedLock.tryUnlock(). The production change is correct β€” a single logger.warn() call using the inherited SLF4J logger, with the exception passed for stack trace logging. WARN level is appropriate for a secondary failure during timeout cleanup.

Two minor style notes (non-blocking):

  1. Test class visibility: IpcNamedLockTest is declared package-private while every other test class in the project uses public class. Consider adding public for consistency.

  2. stderr capture pattern: The test captures System.err to verify slf4j-simple output. This is pragmatic given the project's test dependencies, but worth noting it's not thread-safe for parallel test execution and depends on slf4j-simple default configuration.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@elharo

elharo commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor Author

@elharo

elharo commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

The Verify failures are pre-existing on master, not caused by this change.

Master commit 89f2bc1 has the identical 18 failing Verify jobs (e.g. windows-latest jdk-21-zulu 4.0.0-rc-6 fails on the same lines). The failure is a test-compile error in the maven-resolver-impl module:

DefaultRepositorySystemReentrancyTest.java:[361,17] incompatible types: no instance(s) of type variable(s) T exist so that java.util.List<T> conforms to java.util.Map<java.lang.String,org.eclipse.aether.spi.validator.ValidatorFactory>

introduced by commit f164aa9 Enh: Allow validator factory to abstain (#2008).

This PR only modifies the maven-resolver-named-locks-ipc module (IpcNamedLock + a regression test). All 27 unit tests + ITs for that module pass locally (-Prun-its verify), and spotless:check is green.

@kwin

kwin commented Aug 8, 2026

Copy link
Copy Markdown
Member

Master has been fixed meanwhile. Can you rebase?

@elharo
elharo merged commit 8b3b700 into master Aug 9, 2026
23 checks passed
@elharo
elharo deleted the fix-1994-ipc-named-lock-unlock-log branch August 9, 2026 11:15
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

@elharo Please assign appropriate label to PR according to the type of change.

@github-actions github-actions Bot added this to the 2.0.22 milestone Aug 9, 2026
@cstamas cstamas added the enhancement New feature or request label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty catch swallows exceptions in IpcNamedLock.tryUnlock()

4 participants