question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Corrupted zip (jar) file and other issues in incremental builds

See original GitHub issue

We’re getting few different issues during incremental builds on developer machines where particularly buck kill helps.

Issue 1: Corrupted zip file of a jar from another module

./buckw build //instant:bin_devDebug
Creating action graph: finished in 0.5 sec
Downloaded 113 artifacts, 15.56 Mbytes, 13.2% cache miss
Building: finished in 41.0 sec (100%) 2765/3373 jobs, 174 updated
  Total time: 41.8 sec
Command failed with exit code 1.
stderr: /Users/user/project/mymodule/main/java/com/mymodule/MyClass.java:5: error: cannot access com.mymodule2.SomeClass
import com.mymodule2.SomeClass;
                             ^
  bad class file: /Users/user/project/buck-out/gen/mymodule2/lib__src_main__output/src_main.jar(com/mymodule2/SomeClass.class)
    unable to access file: corrupted zip file
    Please remove or make sure it appears in the correct subdirectory of the classpath.
Errors: 1. Warnings: 0.

    When running <javac>.
    When building rule //mymodule:src_release.

It can happen with any module combination. jar file is actually present in expected path and seems to be valid (javap dumps of classes are fine too).

Running same build command will fail again.

buckw kill fixes it.


Issue 2: Java code can’t reference Kotlin class from another module

Command failed with exit code 1.
instant-scoop/scoop-activity/src/main/java/com/lyft/android/scoop/app/activity/ScoopActivity.kt:8:27: error: unresolved reference: IRxActivityBinder
import me.lyft.android.rx.IRxActivityBinder
                          ^
instant-scoop/scoop-activity/src/main/java/com/lyft/android/scoop/app/activity/ScoopActivity.kt:9:27: error: unresolved reference: RxActivityBinder
import me.lyft.android.rx.RxActivityBinder
                          ^
instant-scoop/scoop-activity/src/main/java/com/lyft/android/scoop/app/activity/ScoopActivity.kt:13:17: error: unresolved reference: IRxActivityBinder
    val binder: IRxActivityBinder = RxActivityBinder()
                ^
instant-scoop/scoop-activity/src/main/java/com/lyft/android/scoop/app/activity/ScoopActivity.kt:13:37: error: unresolved reference: RxActivityBinder
    val binder: IRxActivityBinder = RxActivityBinder()
                                    ^

    When running <kotlinc -d /Users/user/src/instant-android/buck-out/bin/instant-scoop/scoop-activity/lib__src_release__scratch/classes -classpath /Users/user/Library/Android/sdk/platforms/android-28/android.jar:/Users/user/Library/Android/sdk/platforms/android-28/optional/android.test.base.jar:/Users/user/Library/Android/sdk/platforms/android-28/optional/android.test.mock.jar:/Users/user/Library/Android/sdk/

IRxActivityBinder was a new class, added to to the module. Module was already in dependency list of target module.

Running the build again will fail. buck kill fixes the issue.

Looks like something is off about the Buck daemon 🤔


Environment:

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Blissecommented, Mar 9, 2019

I want to say that we’re also experiencing this issue and it’s really crippling to our developer velocity. Essentially to the point that we have a git hook to run ./buckw kill after changing anything.

Any suggestions to help us diagnose this issue would be appreciated.

0reactions
jbarr21commented, Mar 5, 2020

We’re seeing this as well. These occurred mostly after rebases. One particular reproducible instance was pulling master and rebasing to pickup a new inner enum defined in a Java scope consumed by Kotlin

Read more comments on GitHub >

github_iconTop Results From Across the Web

Corrupt JAR file used in a build can cause an Internal Error - IBM
When you are building in IBM® Rational® Application Developer (RAD), if a needed JAR file is corrupt, you get an Internal Error with...
Read more >
543506 – java 9, 10, 11 projects: jar files are locked - Bugs
It worked for a clean build right after eclipse is started. In the incremental build is the jar file lock issue too.
Read more >
Show path to corrupted zip file if it causes failure while ...
Create an artifact containing 'Extracted directory' element pointing to a corrupted zip file (e.g. with incorrect crc values) and invoke 'Build Artifacts' ...
Read more >
Corrupt jar file - java - Stack Overflow
This regularly occurs when you change the extension on the JAR for ZIP, extract the zip content and make some modifications ...
Read more >
Incremental synchronization of ZIP files in bandwidth ...
For example, you have to upload a fat JAR with the new build over a metered connection, and the server literally sits in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found