GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix listener error swallowing (#1990), SyncContext double-close (#1992), and test flakiness (#1350) by slachiewicz · Pull Request #2108 · apache/maven-resolver

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Sep 1, 2026

Copy link
Copy Markdown
Member

Summary of Fixes

  1. #1990: ChainedRepositoryListener and ChainedTransferListener now log exceptions from listeners at WARNING level in handleError() instead of silently swallowing them. Added unit tests verifying that an exception in one listener does not disrupt delivery to subsequent listeners in the multicast chain.
  2. #1992: Refactored DefaultArtifactResolver and DefaultMetadataResolver to eliminate redundant internal/finally SyncContext.close() calls, ensuring SyncContext instances are closed strictly once. Added unit test testSyncContextIsClosedExactlyOnce verifying single-close lifecycle.
  3. #1350 ([MRESOLVER-674]): Seeded Random in GenericVersionTest.testCompareUuidRandom with a fixed seed to ensure deterministic, reproducible test runs across CI environments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@slachiewicz
[MRESOLVER-674][apache#1990][apache#1992] Fix listener error swallowi…
bf8c37d
…ng, sync context double-close and derandomize tests

- apache#1990: Log listener exceptions in ChainedRepositoryListener and ChainedTransferListener; add unit tests for multicast resilience.
- apache#1992: Prevent SyncContext double-close in DefaultArtifactResolver and DefaultMetadataResolver; add verification test.
- apache#1350: Derandomize GenericVersionTest.testCompareUuidRandom with fixed seed.
@slachiewicz slachiewicz added bug Something isn't working maintenance labels Sep 1, 2026
@slachiewicz slachiewicz added this to the 2.1.0 milestone Sep 1, 2026
@slachiewicz
slachiewicz requested a review from elharo September 1, 2026 20:48
@slachiewicz
slachiewicz marked this pull request as ready for review September 1, 2026 20:49
@slachiewicz slachiewicz modified the milestones: 2.1.0, 2.0.24 Sep 1, 2026
This was referenced Sep 1, 2026
Listener RuntimeException silently swallowed by default in ChainedRepositoryListener/ChainedTransferListener #1990
Closed
SyncContext double-close risk in DefaultArtifactResolver and DefaultMetadataResolver #1992
Closed
[MRESOLVER-674] Derandomize GenericVersionTest.testCompareUuidRandom #1350
Closed
@slachiewicz slachiewicz modified the milestones: 2.0.24, 2.0.23 Sep 1, 2026
gnodet
gnodet requested changes Sep 1, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Two confirmed resource leaks (HIGH) in DefaultArtifactResolver and DefaultMetadataResolver where removing try-with-resources creates a gap: if the second syncContextFactory.newInstance() call throws, the first shared SyncContext is never closed. The original code handled this correctly via try-with-resources semantics. The test for the SyncContext fix is technically valid but misleading — it uses a single SyncContext instance for both shared and exclusive roles, making the assertion comment inaccurate.

The listener error handling improvement and test derandomization are sound.


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

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultMetadataResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...esolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultArtifactResolverTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...-resolver-util/src/main/java/org/eclipse/aether/util/listener/ChainedRepositoryListener.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

gnodet
gnodet requested changes Sep 1, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Two confirmed resource leaks (HIGH) in DefaultArtifactResolver and DefaultMetadataResolver where removing try-with-resources creates a gap: if the second syncContextFactory.newInstance() call throws, the first shared SyncContext is never closed. The original code handled this correctly via try-with-resources semantics. The test for the SyncContext fix is technically valid but misleading — it uses a single SyncContext instance for both shared and exclusive roles, making the assertion comment inaccurate.

The listener error handling improvement and test derandomization are sound.


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

Claude Code on behalf of Guillaume Nodet

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultArtifactResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultMetadataResolver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...esolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultArtifactResolverTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...-resolver-util/src/main/java/org/eclipse/aether/util/listener/ChainedRepositoryListener.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@slachiewicz
Close the shared SyncContext when the exclusive one cannot be created
774ba00
Review follow-up: the shared context was created outside any try
block, so a SyncContextFactory that throws while creating the exclusive
context leaked it. The request loop now runs before either context is
created, and the shared context is closed if the exclusive one cannot
be obtained. The shared-to-exclusive hand-over reassigns before closing
so a throwing close() cannot leave the shared context to be closed
twice. The lifecycle test uses distinct instances for the two roles.
@slachiewicz
slachiewicz marked this pull request as draft September 1, 2026 22:57
elharo

This comment was marked as resolved.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slachiewicz
Clean up imports in listener classes and add SyncContext tests for De…
0d76d59
…faultMetadataResolver
@slachiewicz
slachiewicz marked this pull request as ready for review September 4, 2026 11:58
@gnodet gnodet mentioned this pull request Sep 4, 2026
[1.9.x] Fix listener error swallowing (#1990), SyncContext double-close (#1992), and test flakiness (#1350) #2109
Merged
@slachiewicz
Restore try-with-resources for SyncContext via close-once wrapper
a9d1d5c
@slachiewicz
slachiewicz requested review from cstamas, elharo and gnodet September 5, 2026 10:31
elharo
elharo approved these changes Sep 5, 2026
View reviewed changes
@slachiewicz slachiewicz closed this Sep 6, 2026
@github-actions github-actions Bot removed this from the 2.0.23 milestone Sep 6, 2026
@gnodet gnodet reopened this Sep 7, 2026
gnodet
gnodet approved these changes Sep 8, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Re-review after follow-up commits (0d76d59, a9d1d5c). All previous findings are addressed:

  1. ✅ Resource leak (HIGH) — DefaultArtifactResolver: Restored try-with-resources using CloseOnceSyncContext wrapper. The creation window is now safe: if newInstance(session, false) throws, try-with-resources closes the shared context. The CloseOnceSyncContext correctly delegates close() at most once, and the resolve() finally block properly handles the case where current == shared (closes exclusive too via nested try-finally).

  2. ✅ Resource leak (HIGH) — DefaultMetadataResolver: Same fix applied symmetrically.

  3. ✅ Misleading test (MEDIUM): Now uses two distinct counting instances dispatched by the shared flag, each asserted closed exactly once. New testSharedSyncContextIsClosedWhenExclusiveCannotBeCreated test directly covers the resource leak scenario. Test also added for DefaultMetadataResolver.

  4. ✅ JUL imports (LOW): Fully-qualified class names replaced with proper imports. JUL deliberately kept since maven-resolver-util has no SLF4J dependency — reasonable tradeoff.

The CloseOnceSyncContext wrapper is well designed: package-private, clear Javadoc, IllegalStateException on acquire-after-close. The closed field correctly omits volatile since SyncContext is single-threaded by contract.

Note: No milestone is set — this should target 2.0.23.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cstamas added 2 commits September 8, 2026 10:09
@cstamas
Apply common pattern in Resolver
566b89c
The "close once" pattern is using AtomicBoolean in resolver.

Also make sure that the only SyncContext close method is
idempotent
@cstamas
Add check
8ad0b9f
cstamas
cstamas approved these changes Sep 8, 2026
View reviewed changes
@cstamas

cstamas commented Sep 8, 2026

Copy link
Copy Markdown
Member

Applied two changes:

  • while SyncContext is ST, the common pattern in Resolver is use of AtomicBoolean to implement idempotent close method
  • applied same pattern to only one existing SyncContext implementation, thus making close method idempotent
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was linked to issues Sep 8, 2026
Listener RuntimeException silently swallowed by default in ChainedRepositoryListener/ChainedTransferListener #1990
Closed
SyncContext double-close risk in DefaultArtifactResolver and DefaultMetadataResolver #1992
Closed
[MRESOLVER-674] Derandomize GenericVersionTest.testCompareUuidRandom #1350
Closed
@cstamas
cstamas merged commit 0a74153 into apache:master Sep 8, 2026
20 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@slachiewicz
slachiewicz deleted the fix/issues-1990-1992-1350 branch September 8, 2026 08:52
@github-actions github-actions Bot assigned cstamas Sep 8, 2026
@github-actions github-actions Bot added this to the 2.0.23 milestone Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cstamas cstamas cstamas approved these changes
@gnodet gnodet gnodet approved these changes
@elharo elharo elharo approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@cstamas cstamas

Labels

bug Something isn't working maintenance

Projects

None yet

Milestone

2.0.23

Development

Successfully merging this pull request may close these issues.

SyncContext double-close risk in DefaultArtifactResolver and DefaultMetadataResolver Listener RuntimeException silently swallowed by default in ChainedRepositoryListener/ChainedTransferListener [MRESOLVER-674] Derandomize GenericVersionTest.testCompareUuidRandom

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@slachiewicz @cstamas @gnodet @elharo
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.