Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot finish task jibDockerBuild use 2byte character in container args #626

Closed
sakebook opened this issue Jul 16, 2018 · 5 comments
Closed
Assignees
Milestone

Comments

@sakebook
Copy link

Use Gradle plugin. jib.container.args = ['日本語']

$ ./gradlew clean jibDockerBuild

Cannot finish task.

jib-gradle-plugin Configuration:

plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.2.50'
    id "application"
    id 'com.google.cloud.tools.jib' version '0.9.6'
}

group 'com.github.sakebook'
version '0.0.1-SNAPSHOT'
mainClassName = 'com.github.sakebook.word2vec.Word2VecKt'

jar {
    manifest {
        attributes 'Main-Class': 'com.github.sakebook.word2vec.Word2VecKt'
    }
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}

jib {
    to {
        image = 'sakebook/word2vec-deeplearning4j-kotlin'
        auth {
            username = USERNAME // Defined in 'gradle.properties'.
            password = PASSWORD
        }
    }
    container {
        args = ['日本語']
    }
}


repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    compile "org.deeplearning4j:deeplearning4j-core:0.9.1"
    compile "org.deeplearning4j:deeplearning4j-nlp:0.9.1"
    compile "org.nd4j:nd4j-native-platform:0.9.1"
    compile "org.slf4j:slf4j-simple:1.7.25"
    compile "org.slf4j:slf4j-api:1.7.25"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

Log output:

word2vec$ ./gradlew clean jibDockerBuild
warning: Could not find build output directory 'xxxxxx/word2vec/build/classes/java/main'
warning: Base image 'gcr.io/distroless/java' does not use a specific image digest - build may not be reproducible

Containerizing application to Docker daemon as sakebook/word2vec-deeplearning4j-kotlin...

Getting base image gcr.io/distroless/java...
Building dependencies layer...
Building resources layer...
Building classes layer...
Finalizing...
Loading to Docker daemon...
<==========---> 83% EXECUTING [1h 19m 22s]

Additional Information:

My application wrote by Kotlin.

@chanseokoh
Copy link
Member

Confirmed it is reproducible with Maven. Works if no multi-byte characters are given as container arguments.

@chanseokoh
Copy link
Member

chanseokoh commented Jul 16, 2018

Only when pushing to the local docker daemon. Might be that we are miscalculating the length of a string or something when multi-byte chars are involved?

Stack trace from mvn -X jib:buildTar
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.7-SNAPSHOT:buildTar (default-cli) on project _MavenJavaTest: Building image tarball failed: request to write '719' bytes exceeds size in header of '713' bytes for entry 'config.json' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.7-SNAPSHOT:buildTar (default-cli) on project _MavenJavaTest: Building image tarball failed
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Building image tarball failed
        at com.google.cloud.tools.jib.maven.BuildTarMojo.execute(BuildTarMojo.java:129)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.io.IOException: request to write '719' bytes exceeds size in header of '713' bytes for entry 'config.json'
        at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.write(TarArchiveOutputStream.java:447)
        at java.io.OutputStream.write(OutputStream.java:75)
        at com.google.cloud.tools.jib.tar.TarStreamBuilder.lambda$addEntry$1(TarStreamBuilder.java:99)
        at com.google.cloud.tools.jib.tar.TarStreamBuilder.writeEntriesAsTarArchive(TarStreamBuilder.java:62)
        at com.google.cloud.tools.jib.blob.WriterBlob.writeTo(WriterBlob.java:36)
        at com.google.cloud.tools.jib.builder.steps.WriteTarFileStep.afterPushBaseImageLayerFuturesFuture(WriteTarFileStep.java:99)
        at com.google.common.util.concurrent.CombinedFuture$CallableInterruptibleTask.runInterruptibly(CombinedFuture.java:181)
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
        Suppressed: java.io.IOException: This archive contains unclosed entries.
                at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.finish(TarArchiveOutputStream.java:289)
                at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.close(TarArchiveOutputStream.java:306)
                at com.google.cloud.tools.jib.tar.TarStreamBuilder.$closeResource(TarStreamBuilder.java:65)
                at com.google.cloud.tools.jib.tar.TarStreamBuilder.writeEntriesAsTarArchive(TarStreamBuilder.java:65)
                ... 7 more

@coollog
Copy link
Contributor

coollog commented Jul 16, 2018

@TadCordle

@coollog
Copy link
Contributor

coollog commented Jul 20, 2018

@sakebook we've just release version 0.9.7 and this with fix for this issue - can you try again with the new version?

@sakebook
Copy link
Author

Works fine! Thank you mentions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants