[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-269) Shrinkwrap is hanging in JdkZipExporterDelegate

Andrew Rubinger (JIRA) jira-events at lists.jboss.org
Thu Apr 14 08:35:33 EDT 2011


    [ https://issues.jboss.org/browse/SHRINKWRAP-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595565#comment-12595565 ] 

Andrew Rubinger commented on SHRINKWRAP-269:
--------------------------------------------

This shows better what Carlo is talking about:

{code} @Test
    public void testExecutor() throws InterruptedException, IOException {
        ConfigurationBuilder builder = new ConfigurationBuilder()
                .executorService(Executors.newFixedThreadPool(1));
        ArchiveFactory factory = ShrinkWrap.createDomain(builder).getArchiveFactory();
        ArchiveFactory factory2 = ShrinkWrap.getDefaultDomain().getArchiveFactory();
        // blow the pipe
        factory.create(JavaArchive.class, "test.jar")
            .add(MegaByteAsset.newInstance(), "dummy")
            .as(ZipExporter.class)
            .exportAsInputStream();

        InputStream in2 = factory.create(JavaArchive.class, "test2.jar")
            .add(MegaByteAsset.newInstance(), "dummy")
            .as(ZipExporter.class)
            .exportAsInputStream();
        in2.read();
    }{code}

Though IMO this really looks like an error in config.  An export task is not completed until the stream is fully read, and we should expect that export task requests that exceed the number of workers will block.

Carlo's point is that the design should be bulletproof such that it's impossible for the user to create a hang, but the reason the current design is in place is to create a "pull" model: the export is carried out as the reader drains the buffer.  This means that the CPU won't just chug away without anyone bothering to read the result, and also the RAM impact is limited to a small buffer, not the entire contents of the exported archive.  ZipExporterStressTestCase must continue to pass in any potential redesign, and IMO this issue should be closed after simply documenting that it's the user's responsibility to fully-read the InStream to complete an export task.

> Shrinkwrap is hanging in JdkZipExporterDelegate
> -----------------------------------------------
>
>                 Key: SHRINKWRAP-269
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-269
>             Project: ShrinkWrap
>          Issue Type: Bug
>         Environment: org.jboss.as.testsuite.integration.jaxrs.servletintegration.ApplicationPathOverrideIntegrationTestCase
>            Reporter: Carlo de Wolf
>            Assignee: Andrew Rubinger
>
> {noformat}
> $ jstack 3994
> 2011-04-01 21:59:20
> Full thread dump Java HotSpot(TM) Server VM (19.0-b09 mixed mode):
> "Attach Listener" daemon prio=10 tid=0x8e11c400 nid=0x109a waiting on condition [0x00000000]
>    java.lang.Thread.State: RUNNABLE
> "pool-2-thread-1" prio=10 tid=0xb6af5400 nid=0xfbd in Object.wait() [0x8d8fe000]
>    java.lang.Thread.State: TIMED_WAITING (on object monitor)
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <0xa997c858> (a org.jboss.shrinkwrap.impl.base.exporter.FutureCompletionInputStream)
> 	at java.io.PipedInputStream.awaitSpace(PipedInputStream.java:257)
> 	at java.io.PipedInputStream.receive(PipedInputStream.java:215)
> 	- locked <0xa997c858> (a org.jboss.shrinkwrap.impl.base.exporter.FutureCompletionInputStream)
> 	at java.io.PipedOutputStream.write(PipedOutputStream.java:132)
> 	at java.util.zip.ZipOutputStream.writeBytes(ZipOutputStream.java:456)
> 	at java.util.zip.ZipOutputStream.writeLOC(ZipOutputStream.java:351)
> 	at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:179)
> 	at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate$2.execute(JdkZipExporterDelegate.java:285)
> 	at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate$2.execute(JdkZipExporterDelegate.java:262)
> 	at org.jboss.shrinkwrap.impl.base.io.IOUtil.closeOnComplete(IOUtil.java:227)
> 	at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate.processNode(JdkZipExporterDelegate.java:261)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:98)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.processNode(AbstractExporterDelegate.java:103)
> 	at org.jboss.shrinkwrap.impl.base.exporter.AbstractExporterDelegate.export(AbstractExporterDelegate.java:88)
> 	at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate.access$001(JdkZipExporterDelegate.java:55)
> 	at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate$1.call(JdkZipExporterDelegate.java:134)
> 	at org.jboss.shrinkwrap.impl.base.exporter.JdkZipExporterDelegate$1.call(JdkZipExporterDelegate.java:127)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:662)
> "Thread-1" prio=10 tid=0x8dcb1400 nid=0xfac runnable [0x8da5c000]
>    java.lang.Thread.State: RUNNABLE
> 	at java.io.FileInputStream.readBytes(Native Method)
> 	at java.io.FileInputStream.read(FileInputStream.java:199)
> 	at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
> 	at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> 	- locked <0xaaa88b90> (a java.io.BufferedInputStream)
> 	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
> 	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
> 	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
> 	- locked <0xaaa88ce0> (a java.io.InputStreamReader)
> 	at java.io.InputStreamReader.read(InputStreamReader.java:167)
> 	at java.io.Reader.read(Reader.java:123)
> 	at org.jboss.as.arquillian.container.managed.JBossAsManagedContainer$ConsoleConsumer.run(JBossAsManagedContainer.java:188)
> 	at java.lang.Thread.run(Thread.java:662)
> "process reaper" daemon prio=10 tid=0x8dcfe000 nid=0xfaa runnable [0x8daad000]
>    java.lang.Thread.State: RUNNABLE
> 	at java.lang.UNIXProcess.waitForProcessExit(Native Method)
> 	at java.lang.UNIXProcess.access$900(UNIXProcess.java:20)
> 	at java.lang.UNIXProcess$1$1.run(UNIXProcess.java:132)
> "Low Memory Detector" daemon prio=10 tid=0xb6a99400 nid=0xfa5 runnable [0x00000000]
>    java.lang.Thread.State: RUNNABLE
> "CompilerThread1" daemon prio=10 tid=0xb6a97800 nid=0xfa4 waiting on condition [0x00000000]
>    java.lang.Thread.State: RUNNABLE
> "CompilerThread0" daemon prio=10 tid=0xb6a95800 nid=0xfa3 waiting on condition [0x00000000]
>    java.lang.Thread.State: RUNNABLE
> "Signal Dispatcher" daemon prio=10 tid=0xb6a93c00 nid=0xfa2 runnable [0x00000000]
>    java.lang.Thread.State: RUNNABLE
> "Finalizer" daemon prio=10 tid=0xb6a84400 nid=0xfa1 in Object.wait() [0x8f167000]
>    java.lang.Thread.State: WAITING (on object monitor)
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <0xaaa893e8> (a java.lang.ref.ReferenceQueue$Lock)
> 	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
> 	- locked <0xaaa893e8> (a java.lang.ref.ReferenceQueue$Lock)
> 	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
> 	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
> "Reference Handler" daemon prio=10 tid=0xb6a82c00 nid=0xfa0 in Object.wait() [0x8f47d000]
>    java.lang.Thread.State: WAITING (on object monitor)
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <0xaaa89478> (a java.lang.ref.Reference$Lock)
> 	at java.lang.Object.wait(Object.java:485)
> 	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
> 	- locked <0xaaa89478> (a java.lang.ref.Reference$Lock)
> "main" prio=10 tid=0xb6a04c00 nid=0xf9c in Object.wait() [0xb6bf7000]
>    java.lang.Thread.State: WAITING (on object monitor)
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <0xa9a90b70> (a org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager$Handler)
> 	at java.lang.Object.wait(Object.java:485)
> 	at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager$Handler.get(ModelControllerClientServerDeploymentManager.java:164)
> 	- locked <0xa9a90b70> (a org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager$Handler)
> 	at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager$Handler.get(ModelControllerClientServerDeploymentManager.java:64)
> 	at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:68)
> 	at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:41)
> 	at org.jboss.as.arquillian.container.AbstractDeployableContainer.executeDeploymentPlan(AbstractDeployableContainer.java:180)
> 	at org.jboss.as.arquillian.container.AbstractDeployableContainer.deploy(AbstractDeployableContainer.java:98)
> 	at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:62)
> 	at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:50)
> 	at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
> 	at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
> 	at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:99)
> 	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:165)
> 	at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:189)
> 	at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:300)
> 	at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:185)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> 	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:128)
> 	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
> 	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
> 	at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
> "VM Thread" prio=10 tid=0xb6a80400 nid=0xf9f runnable 
> "GC task thread#0 (ParallelGC)" prio=10 tid=0xb6a0bc00 nid=0xf9d runnable 
> "GC task thread#1 (ParallelGC)" prio=10 tid=0xb6a0d400 nid=0xf9e runnable 
> "VM Periodic Task Thread" prio=10 tid=0xb6a9ac00 nid=0xfa6 waiting on condition 
> JNI global references: 954
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the shrinkwrap-issues mailing list