You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Brian O'Keefe (JIRA)" <ji...@apache.org> on 2015/07/30 16:53:05 UTC

[jira] [Commented] (CAMEL-8241) Exec command failures using Java 8 on Unix

    [ https://issues.apache.org/jira/browse/CAMEL-8241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14647734#comment-14647734 ] 

Brian O'Keefe commented on CAMEL-8241:
--------------------------------------

FYI -- This bug is not resolved for me in Camel 2.15.0 because the workaround in components/camel-exec/src/main/java/org/apache/camel/component/exec/impl/DefaultExecCommandExecutor.java looks for the string "if ("Stream closed".equals(msg)) {...", but on my JVM the exception message is actually "Stream Closed".  See stack trace below.  I am not very familiar with how to report that a workaround is still broken in JIRA, so please advise.

       at org.apache.camel.component.exec.impl.DefaultExecCommandExecutor.execute(DefaultExecCommandExecutor.java:102)
        at org.apache.camel.component.exec.ExecProducer.process(ExecProducer.java:53)
        at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
        at org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:736)
        at org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:83)
        at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:304)
        at org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:289)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Stream Closed
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:307)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
        at org.apache.commons.exec.DefaultExecutor.closeProcessStreams(DefaultExecutor.java:306)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:387)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
        at org.apache.camel.component.exec.impl.DefaultExecCommandExecutor.execute(DefaultExecCommandExecutor.java:69)
        ... 21 more


> Exec command failures using Java 8 on Unix
> ------------------------------------------
>
>                 Key: CAMEL-8241
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8241
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.14.0
>         Environment: JDK 1.8 on Unix systems
>            Reporter: Dave Heath
>            Assignee: Claus Ibsen
>             Fix For: 2.14.2, 2.15.0
>
>         Attachments: CamelExecTest.java
>
>
> I'm attaching a test case that shows an issue I've been running into with the exec command since updating my environment to Java 8. It appears that I'm running into a race condition where a stream is sometimes closed prematurely before DefaultExecutor has a chance to close it, causing DefaultExecCommandExecutor to throw and exit (even though the command did execute properly). I've tested this against the updated version of commons-exec as well just to make sure this hasn't somehow been fixed in that library.
> Please note that the attached test doesn't always fail; you may need to run it a few times before the error will show up.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)