Skip to content

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Nov 14, 2025

Three major issues:

  • (prefix) one was that it tried to fix the Maven issue of remote repository uniqueness (globally), and that attempt was in fact wrong, fix is elsewhere. The reason it tried to do this is in fact to circumvent locking issues Locking issues #1644.
  • (manager) other issue was filter lifecycle, manager did it wrongly (data is inherited on customized sessions): the bug caused that one session was used to acquire filters and same filter got used for potentially other (maybe even reconfigured) session. This overlook forced filters to implement hoops and loops (to prevent recursion), but also prevented any third party code to have saying in filter operation.
  • (both filters) make sure RemoteRepositories used as keys for prefixes are same (normalized as bare)

Changes:

  • fix manager to make sure filters and session are aligned
  • fix/simplify prefix filter recursion prevention
  • introduce public and documented way to inhibit prefix discovery

Note: as this PR now removes the "hack" (that in fact tried to circumvent #1644) we are now back at state we were before #1575 (the "by make repositories unique" bit). As we see, this change (without locking fix) will cause Maven IT failures, as ITs are executed in parallel, and "prefix discovery" initiated over same local repository will/may cause locking conflicts and hence timeouts (result is sporadically failing ITs due locking timeouts). Hence, this fix is to be followed by fix for #1644

Fixes #1654
Fixes #1667

Two major issues: one was that it tried to fix the Maven issue
of remote repository uniqueness (globally), and that attempt
was in fact wrong, fix is elsewhere. The reason it tried to do
this is in fact to circumvent locking issues apache#1644.

The other issue was filter lifecycle, manager did it wrongly:
the bug caused that one session was used to acquire filters
and same filter got used for potentially other (maybe even
reconfigured) session. This overlook forced filters to
implement hoops and loops (to prevent recursion), but also
prevented any third party code to have saying in filter
operation.

Changes:
* fix manager to make sure filters and session are aligned
* fix/simplify prefix filter recursion prevention
* introduce public and documented way to inhibit prefix discovery
@cstamas cstamas requested review from gnodet and kwin November 14, 2025 13:56
cstamas added a commit to cstamas/maven-resolver that referenced this pull request Nov 14, 2025
Also, fix misaligned filter sources re session

This is "mild backport" of apache#1655
@cstamas cstamas self-assigned this Nov 14, 2025
@cstamas cstamas marked this pull request as ready for review November 14, 2025 17:26
@cstamas cstamas added the bug Something isn't working label Nov 14, 2025
@cstamas cstamas added this to the 2.0.14 milestone Nov 17, 2025
Whenever RemoteRepository is used as a key in map, it has to
be normalized, as otherwise things may fall apart.
@cstamas cstamas changed the title Bug: fix prefix filter discovery Bug: Filter fixes Nov 17, 2025
cstamas added a commit that referenced this pull request Nov 17, 2025
Changes:
* fix manager to make sure filters and session are aligned
* support same (newly introduced) properties

This is "mild backport" of #1655

private boolean supportedResolvePrefixesForRemoteRepository(
RepositorySystemSession session, RemoteRepository remoteRepository) {
// TODO: RemoteRepository.isRepositoryManager() is still unused in Maven; once used, factor it in
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be a good idea to create an issue in Maven and reference it here, so that we can track more easily in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RRF: make sure prefix discovery happens only once per session RRF auto discovery is broken (tried to circumvent locking issue)

2 participants