You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "scholzb-hb (via GitHub)" <gi...@apache.org> on 2026/03/06 20:52:58 UTC
[I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
scholzb-hb opened a new issue, #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463
### Affected version
1.2.2
### Bug description
In a certain scenario, the build may result in a cache miss although the required cache entry is available on the remote cache.
The scenario is as follows (all builds on the same source code commit):
1. Build runner A runs a build with -DskipTests and saves the result in the remote cache
2. Build runner B runs a build with -DskipTests and loads the result from the remote cache (skipping the actual build)
3. Build runner A runs a build without -DskipTests. Cache entry is found, but considered incomplete since skipTests was enabled. Tests are executed, and the result is saved in the remote cache again (under the same checksum, now with skipTests=false).
4. Build runner B runs a build without -DskipTests. Now the bug can be observed.
**Expected behavior**
Build runner B should load the result from the remote cache (from step 3). Test execution should be skipped.
**Actual behavior**
Build runner B finds the downloaded cache entry from step 2 in its local cache and considers it as incomplete, without checking the remote cache. Tests are executed again.
**Reproduce**
The scenario can be reproduced with the attached demo project. [reproducer.zip](https://github.com/user-attachments/files/25804262/reproducer.zip)
Prerequisites:
Empty remote cache (Nexus 3) running under http://localhost:8081/repository/buildcache, settings.xml contains a corresponding entry like
```
<server>
<id>buildcache</id>
<username>ci</username>
<password>password</password>
</server>
```
Commands to execute in the "reproducer" directory:
```
rm -rf buildrunnerA_m2/build-cache
rm -rf buildrunnerB_m2/build-cache
mvn clean install -Dmaven.repo.local=buildrunnerA_m2/repository -Dmaven.build.cache.remote.save.enabled=true -f demo/pom.xml -DskipTests
mvn clean install -Dmaven.repo.local=buildrunnerB_m2/repository -Dmaven.build.cache.remote.save.enabled=true -f demo/pom.xml -DskipTests
mvn clean install -Dmaven.repo.local=buildrunnerA_m2/repository -Dmaven.build.cache.remote.save.enabled=true -f demo/pom.xml
mvn clean install -Dmaven.repo.local=buildrunnerB_m2/repository -Dmaven.build.cache.remote.save.enabled=true -f demo/pom.xml
```
Result:
```
[INFO] Attempting to restore project com.example:demo from build cache
[INFO] Downloaded build found by checksum b882441c46a44429
[INFO] Found cached build, restoring com.example:demo from cache by checksum b882441c46a44429
[INFO] Plugin parameter mismatch found. Parameter: skipTests, expected: true, actual: false
[INFO] Mojo cached parameters mismatch with actual, forcing full project build. Mojo: surefire:test
[INFO] A cached mojo is not consistent, continuing with non cached build
```
**Workaround (not feasible in production!)**
Delete buildrunnerB_m2/build-cache/v1.1/com.example/demo/b882441c46a44429/buildcache before step 4. Now the behavior is as expected:
->
```
[INFO] Attempting to restore project com.example:demo from build cache
[INFO] Downloading http://localhost:8081/repository/buildcache/v1.1/com.example/demo/b882441c46a44429/buildinfo.xml
[INFO] Found cached build, restoring com.example:demo from cache by checksum b882441c46a44429
[INFO] Downloading http://localhost:8081/repository/buildcache/v1.1/com.example/demo/b882441c46a44429/demo.jar
[INFO] Downloading http://localhost:8081/repository/buildcache/v1.1/com.example/demo/b882441c46a44429/demo-mvn-cache-ext-extra-output-1.zip
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "scholzb-hb (via GitHub)" <gi...@apache.org>.
scholzb-hb commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4209235569
Let me add some background information about the severity and the impact of this bug:
We have a build job which is performance-critical for the development process within our department. It does compile and test on almost 400 Maven modules and is normally finished after a few minutes, since there is a 100% hit rate from the build cache. When the bug occurs, it usually affects all modules. In this case, the same build job takes **more than 3 hours** since all tests are executed unnecessarily.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4222320047
@scholzb-hb please check the PR https://github.com/apache/maven-build-cache-extension/pull/472
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4212801236
I wonder if you have been reading this documentation https://maven.apache.org/extensions/maven-build-cache-extension/how-to.html#i-occasionally-cached-build-with-dskiptests-true-and-tests-do-no ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "scholzb-hb (via GitHub)" <gi...@apache.org>.
scholzb-hb commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4213696700
Hi, thanks for your reply! Yes, we have read this documentation and configured the reconcile settings exactly as recommended, see attached reproducer.zip:
```
<reconcile>
<plugins>
<plugin artifactId="maven-surefire-plugin" goal="test">
<reconciles>
<reconcile propertyName="skip" skipValue="true" />
<reconcile propertyName="skipExec" skipValue="true" />
<reconcile propertyName="skipTests" skipValue="true" />
<reconcile propertyName="testFailureIgnore" skipValue="true" />
</reconciles>
</plugin>
</plugins>
</reconcile>
```
This works perfectly with and without -DskipTests, as long as the remote cache is not involved. For example, in step 3 everything behaves as expected:
> Build runner A runs a build without -DskipTests. Cache entry is found, but considered incomplete since skipTests was enabled. Tests are executed, and the result is saved in the remote cache again (under the same checksum, now with skipTests=false).
The issue occurs in step 4, when the maven-build-cache-extension **refuses to look into the remote cache**, although the needed cache entry is there. It uses a **stale local copy** of the remote cache content instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4221318722
looking at it but there is a point too integrate about the local copy which could be more recent
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "scholzb-hb (via GitHub)" <gi...@apache.org>.
scholzb-hb commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4226594465
I have tested PR #472 in our environment and everything works as expected! The code changes also seem valid to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "scholzb-hb (via GitHub)" <gi...@apache.org>.
scholzb-hb commented on issue #463:
URL: https://github.com/apache/maven-build-cache-extension/issues/463#issuecomment-4217328457
In my opinion the decision to use a certain cache item is based on the wrong logic.
The current logic seems to be implemented like this (pseudocode, I have omitted the local cache for simplicity):
```
if (Downloaded item matching checksum) {
if (Downloaded item matching plugin parameters) {
Use it
} else {
Rebuild module <-- wrong behavior in our scenario
}
} else if (Remote item matching checksum) {
Download it
if (Downloaded item matching plugin parameters) {
Use it
} else {
Rebuild module
}
} else {
Rebuild module
}
```
The logic should be instead:
```
if (Downloaded item matching checksum AND plugin parameters) {
Use it
} else if (Remote item matching checksum AND plugin parameters) {
Download and use it <-- expected behavior in our scenario
} else {
Rebuild module
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Unexpected cache miss due to previously downloaded remote cache entry with skipTests [maven-build-cache-extension]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy closed issue #463: Unexpected cache miss due to previously downloaded remote cache entry with skipTests
URL: https://github.com/apache/maven-build-cache-extension/issues/463
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org