quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.53k stars 2.61k forks source link

Multimodule Gradle build nondeterministic fails with "java.util.zip.ZipException: zip END header not found" #23750

Closed marcelhanser closed 2 years ago

marcelhanser commented 2 years ago

Describe the bug

In around 60% of our builds we get the following error during a compileTestJava task


    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: java.io.IOException: Failed to create a new filesystem for /var/jenkins_home/workspace/...-g7a6254d-develop-SNAPSHOT.jar
    at io.quarkus.fs.util.ZipUtils.newFileSystem(ZipUtils.java:208)
    at io.quarkus.gradle.tooling.dependency.DependencyUtils.getExtensionInfoOrNull(DependencyUtils.java:111)
    ... 124 more
Caused by: java.util.zip.ZipException: zip END header not found
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.zerror(ZipFileSystem.java:1645)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.findEND(ZipFileSystem.java:1039)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1048)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:116)
    at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:136)
    at io.quarkus.fs.util.ZipUtils.newFileSystem(ZipUtils.java:203)
    ... 125 more```
(full stacktrace is attached: [stacktrace.txt](https://github.com/quarkusio/quarkus/files/8078389/stacktrace.txt))
It started after the moving from quarkus 2.5 to quarkus 2.6 and from gradle 6 to 7.
We do a clean before each build and we already cleaned gradle caches multiple times.****

### Expected behavior

The quarkusBuild should be successful

### Actual behavior

It fails as described

### How to Reproduce?

Hard to say as it just appears in 60% of the times.

I guess it has something todo with a testImplementation dependency to a module which depends on the module itself

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.6.3.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

 ------------------------------------------------------------ Gradle 7.3.2 Build time:   2021-12-15 11:22:31 UTC Revision:     26c186eb63b2b02e68d83b0dbc6ec69ab118653a  Kotlin:       1.5.31 Groovy:       3.0.9 Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM:          11 (Oracle Corporation 11+28) OS:           Windows 10 10.0 amd64

### Additional information

Occurs on windows and linux
quarkus-bot[bot] commented 2 years ago

/cc @evanchooly, @glefloch, @quarkusio/devtools

glefloch commented 2 years ago

Thanks for reporting this @marcelhanser. In your project, are referencing mavenLocal() as repository ? If this is the case, could you remove it or place it in last position if need to access local artifact ?

marcelhanser commented 2 years ago

Hi @glefloch, no we use a corporate repository. Does your suggestion also apply to that?

marcelhanser commented 2 years ago

I dont know if that helps but: We tried a bit around and realized that we can get rid of those errors if we define tasks.dependsOn explicitly for the compileJava tasks. compileJava.dependsOn(project.rootProject.getTasksByName("compileJava", true).find({ it.project.name.equals("otherModuleIdependOn") }))

glefloch commented 2 years ago

Do you have a reproducer @marcelhanser, I think this issue has been fixed in #23802.

marcelhanser commented 2 years ago

Unfortunately not.. its a huge project. But we will try 2.8.x as soon as its released and give feedback here. Would that be fine?

glefloch commented 2 years ago

Sure. Thanks.

glefloch commented 2 years ago

@marcelhanser, 2.8.0.CR1 has been released, could you give a try?

marcelhanser commented 2 years ago

@glefloch sry for the late answer. Our build is stable with 2.8.x! thx!

glefloch commented 2 years ago

No problem, thanks for the answer, I will close the issue then. You can reopen it if you face the issue again.