[ https://issues.apache.org/jira/browse/FELIX-3336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13199665#comment-13199665 ]
Marcel Offermans commented on FELIX-3336: ----------------------------------------- A solution has been committed, but I'm not quite sure why it works. If you do a checkout, and run "mvn clean install" the test succeeds. If you apply this patch: {code} Index: src/main/java/org/apache/felix/deploymentadmin/ExplodingOutputtingInputStream.java =================================================================== --- src/main/java/org/apache/felix/deploymentadmin/ExplodingOutputtingInputStream.java (revision 1240137) +++ src/main/java/org/apache/felix/deploymentadmin/ExplodingOutputtingInputStream.java (working copy) @@ -73,7 +73,7 @@ super(inputStream, output); m_contentDir = root; m_indexFile = index; - m_input = new PipedInputStream(output /*, 8 FELIX-3336: if you provide such a small buffer, the error is reproducible (see below) */); + m_input = new PipedInputStream(output , 8 /* FELIX-3336: if you provide such a small buffer, the error is reproducible (see below) */); m_task = new Thread(this, "Apache Felix DeploymentAdmin - ExplodingOutputtingInputStream"); m_task.start(); } @@ -129,16 +129,16 @@ } } // FELIX-3336: if you include this code, the issue is gone - try { - byte[] bb = new byte[512]; - int c = m_input.read(bb); - while (c != -1) { - c = m_input.read(bb); - } - } - catch (IOException e) { - e.printStackTrace(); - } +// try { +// byte[] bb = new byte[512]; +// int c = m_input.read(bb); +// while (c != -1) { +// c = m_input.read(bb); +// } +// } +// catch (IOException e) { +// e.printStackTrace(); +// } } {code} And then run the test again, you get: {code} $ cat target/surefire-reports/org.apache.felix.deploymentadmin.ExplodingOutputtingInputStreamTest.txt ------------------------------------------------------------------------------- Test set: org.apache.felix.deploymentadmin.ExplodingOutputtingInputStreamTest ------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.071 sec <<< FAILURE! testStream(org.apache.felix.deploymentadmin.ExplodingOutputtingInputStreamTest) Time elapsed: 1.057 sec <<< ERROR! java.io.IOException: Read end dead at java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:246) at java.io.PipedInputStream.awaitSpace(PipedInputStream.java:252) at java.io.PipedInputStream.receive(PipedInputStream.java:215) at java.io.PipedOutputStream.write(PipedOutputStream.java:132) at org.apache.felix.deploymentadmin.OutputtingInputStream.read(OutputtingInputStream.java:58) at org.apache.felix.deploymentadmin.ExplodingOutputtingInputStreamTest.testStream(ExplodingOutputtingInputStreamTest.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [...] {code} For some weird reason the read blocks and finally generates an exception because the pipe has been closed. I have no clue why the read blocks though, and why reading extra bytes from an underlying stream (m_input) that should have already been read completely (this ZipInputStream reads everything it should) unblocks the read. Admittedly, this is not the easiest piece of code to read, but I can't find a fundamental flaw in the approach. Maybe someone else can. :) > Exceptions related to the pipe used in deployment admin > ------------------------------------------------------- > > Key: FELIX-3336 > URL: https://issues.apache.org/jira/browse/FELIX-3336 > Project: Felix > Issue Type: Bug > Components: Deployment Admin > Reporter: Marcel Offermans > > Sporadically getting "Pipe closed" exceptions. Not reproducible yet, but > seemingly related to a line containing "input.close()" in the > ExplodingOutputtingInputStream. Needs investigation. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira