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

Angela Wickert commented on CAMEL-8241:
---------------------------------------

I've got the same problem as described.I've reduced my program on a simple 
route. 

I am using CentOS 6.4, jdk1.8.0_25 and the camel version 2.14.1.

this is the route:
 <route id="test_exec" autoStartup="true">
      <from uri="file://target/test" />
      <to uri="exec:pwd" />
 </route>

and this is the stracktrace:
org.apache.camel.component.exec.ExecException: Unable to execute command 
ExecCommand [args=[], executable=pwd, timeout=9223372036854775807, 
outFile=null, workingDir=null, useStderrOnEmptyStdout=false]
        at 
org.apache.camel.component.exec.impl.DefaultExecCommandExecutor.execute(DefaultExecCommandExecutor.java:81)
        at 
org.apache.camel.component.exec.ExecProducer.process(ExecProducer.java:46)
        at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
        at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
        at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)
        at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at 
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:433)
        at 
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
        at 
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
        at 
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
        at 
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        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.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:433)
        at java.io.OutputStream.write(OutputStream.java:116)
        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.closeStreams(DefaultExecutor.java:288)
        at 
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:364)
        at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
        at 
org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:147)
        at 
org.apache.camel.component.exec.impl.DefaultExecCommandExecutor.execute(DefaultExecCommandExecutor.java:67)
        ... 20 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
>             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)

Reply via email to