maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <j...@codehaus.org>
Subject [jira] (MASSEMBLY-742) Unclosed ZipFile warnings when ZIP archives are included
Date Wed, 28 Jan 2015 21:16:18 GMT

    [ https://jira.codehaus.org/browse/MASSEMBLY-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=361977#comment-361977
] 

Dawid Weiss edited comment on MASSEMBLY-742 at 1/28/15 3:15 PM:
----------------------------------------------------------------

That was my fix too, but it won't work (and you should revert 33f92e0693c659a278ee9eab15e).

Now you close the iterator (which closes the underlying ZipFile) but publish this iterator
entries (which hold references to that ZipFile). This results in attempts to reference a closed
resource.

{code}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.4-SNAPSHOT:single
(private-zip) on project child
2: Failed to create assembly: Error creating assembly archive private: Problem creating zip:
Execution exception (and the archive
is probably corrupt but I could not delete it): Stream Closed -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.
4-SNAPSHOT:single (private-zip) on project child2: Failed to create assembly: Error creating
assembly archive private: Problem cre
ating zip: Execution exception (and the archive is probably corrupt but I could not delete
it)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
        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:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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: Failed to create assembly: Error
creating assembly archive private: Pro
blem creating zip: Execution exception (and the archive is probably corrupt but I could not
delete it)
        at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:541)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: org.apache.maven.plugin.assembly.archive.ArchiveCreationException: Error creating
assembly archive private: Problem cre
ating zip: Execution exception (and the archive is probably corrupt but I could not delete
it)
        at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:185)
        at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:484)
        ... 21 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: Problem creating zip: Execution
exception (and the archive is probably
corrupt but I could not delete it)
        at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:994)
        at org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.createArchive(AssemblyProxyArchiver.java:436)
        at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:181)
        ... 22 more
Caused by: java.io.IOException: Execution exception
        at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.close(AbstractZipArchiver.java:790)
        at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:981)
        ... 24 more
Caused by: java.io.IOException: Stream Closed
        at java.io.RandomAccessFile.seek(Native Method)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.ZipFile$BoundedInputStream.read(ZipFile.java:1038)
        at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:238)
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
        at org.codehaus.plexus.components.io.resources.ClosingInputStream.read(ClosingInputStream.java:36)
        at java.io.SequenceInputStream.read(SequenceInputStream.java:208)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.StreamCompressor.deflate(StreamCompressor.java:168)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.ScatterZipOutputStream.addArchiveEntry(ScatterZipOutputStrea
m.java:97)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.ParallelScatterZipCreator$2.call(ParallelScatterZipCreator.j
ava:175)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
{code}


was (Author: dawid.weiss):
That was my fix too, but it won't work (and you should revert ).

Now you close the iterator (which closes the underlying ZipFile) but publish this iterator
entries (which hold references to that ZipFile). This results in attempts to reference a closed
resource.

{code}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.4-SNAPSHOT:single
(private-zip) on project child
2: Failed to create assembly: Error creating assembly archive private: Problem creating zip:
Execution exception (and the archive
is probably corrupt but I could not delete it): Stream Closed -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.
4-SNAPSHOT:single (private-zip) on project child2: Failed to create assembly: Error creating
assembly archive private: Problem cre
ating zip: Execution exception (and the archive is probably corrupt but I could not delete
it)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
        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:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        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: Failed to create assembly: Error
creating assembly archive private: Pro
blem creating zip: Execution exception (and the archive is probably corrupt but I could not
delete it)
        at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:541)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
Caused by: org.apache.maven.plugin.assembly.archive.ArchiveCreationException: Error creating
assembly archive private: Problem cre
ating zip: Execution exception (and the archive is probably corrupt but I could not delete
it)
        at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:185)
        at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:484)
        ... 21 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: Problem creating zip: Execution
exception (and the archive is probably
corrupt but I could not delete it)
        at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:994)
        at org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.createArchive(AssemblyProxyArchiver.java:436)
        at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:181)
        ... 22 more
Caused by: java.io.IOException: Execution exception
        at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.close(AbstractZipArchiver.java:790)
        at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:981)
        ... 24 more
Caused by: java.io.IOException: Stream Closed
        at java.io.RandomAccessFile.seek(Native Method)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.ZipFile$BoundedInputStream.read(ZipFile.java:1038)
        at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:238)
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
        at org.codehaus.plexus.components.io.resources.ClosingInputStream.read(ClosingInputStream.java:36)
        at java.io.SequenceInputStream.read(SequenceInputStream.java:208)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.StreamCompressor.deflate(StreamCompressor.java:168)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.ScatterZipOutputStream.addArchiveEntry(ScatterZipOutputStrea
m.java:97)
        at org.codehaus.plexus.archiver.commonscompress.archivers.zip.ParallelScatterZipCreator$2.call(ParallelScatterZipCreator.j
ava:175)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
{code}

> Unclosed ZipFile warnings when ZIP archives are included
> --------------------------------------------------------
>
>                 Key: MASSEMBLY-742
>                 URL: https://jira.codehaus.org/browse/MASSEMBLY-742
>             Project: Maven Assembly Plugin
>          Issue Type: Bug
>          Components: dependencySet
>    Affects Versions: 2.5.2
>            Reporter: Dawid Weiss
>            Assignee: Kristian Rosenvold
>            Priority: Minor
>             Fix For: 2.5.3, 2.5.4
>
>         Attachments: example.zip
>
>
> I get the following warnings at the end of Maven build:
> {code}
> Cleaning up unclosed ZipFile for archive C:\...foo-0.2.0-SNAPSHOT.zip
> {code}
> These warnings originate from assembly plugin, but in fact they're caused by the fact
that plexus resource abstraction opens up a ZipFile from commons-compress, but never closes
it. Commons-compress then force-closes all such objects in finalize, emitting a warning.
> I created a synthetic capture of the allocation stack in maven assembly, it's here:
> {code}
> org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:211)
> org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:193)
> org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:154)
> org.codehaus.plexus.archiver.zip.PlexusIoZipFileResourceCollection.getEntries(PlexusIoZipFileResourceCollection.java:29)
> org.codehaus.plexus.components.io.resources.AbstractPlexusIoArchiveResourceCollection.getResources(AbstractPlexusIoArchiveResourceCollection.java:69)
> org.codehaus.plexus.components.io.resources.proxy.PlexusIoProxyResourceCollection.getResources(PlexusIoProxyResourceCollection.java:111)
> org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:493)
> org.codehaus.plexus.archiver.dir.DirectoryArchiver.execute(DirectoryArchiver.java:71)
> org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:940)
> org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.createArchive(AssemblyProxyArchiver.java:541)
> org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:180)
> org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:486)
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
> org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
> org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
> org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
> org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> java.lang.reflect.Method.invoke(Method.java:483)
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> {code}
> Hope this helps, somehow.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Mime
View raw message