"IOException: No space left on device" exception swallowed by camel
-------------------------------------------------------------------

                 Key: CAMEL-5178
                 URL: https://issues.apache.org/jira/browse/CAMEL-5178
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.9.1, 2.9.0
            Reporter: Anders


When routing a file using the GenericFileConsumer object an exception is 
swallowed if the lock file cant be created (i.e there is no harddrive space).

{code:title=GenericFileConsumer.java|borderStyle=solid}
protected void processExchange(final Exchange exchange) {
        GenericFile<T> file = getExchangeFileProperty(exchange);
        log.trace("Processing file: {}", file);

        // must extract the absolute name before the begin strategy as the file 
could potentially be pre moved
        // and then the file name would be changed
        String absoluteFileName = file.getAbsoluteFilePath();

        // check if we can begin processing the file
        try {
            final GenericFileProcessStrategy<T> processStrategy = 
endpoint.getGenericFileProcessStrategy();

            boolean begin = processStrategy.begin(operations, endpoint, 
exchange, file);
            if (!begin) {
                log.debug(endpoint + " cannot begin processing file: {}", file);
                // begin returned false, so remove file from the in progress 
list as its no longer in progress
                endpoint.getInProgressRepository().remove(absoluteFileName);
                return;
            }
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
                log.debug(endpoint + " cannot begin processing file: " + file + 
" due to: " + e.getMessage(), e);
            }
            endpoint.getInProgressRepository().remove(absoluteFileName);
            return;
        }
.
.
.
.
}
{code}

When processStrategy.begin(operations, endpoint, exchange, file); throws an 
java.io.IOException this is swallowed in the catch method and never propagated 
to the error handling of camel. Output from log is: 

{noformat}
11:33:44.290 [Camel (camel-2) thread #1 - file:/Users/xxxx/yyyy/Files/] DEBUG 
o.a.c.component.file.FileConsumer - Endpoint[file:/Users/xxxx/yyyy/Files/] 
cannot begin processing file: GenericFile[//Users/xxxx/yyyy/Files/file01] due 
to: No space left on device
java.io.IOException: No space left on device
        at java.io.UnixFileSystem.createFileExclusively(Native Method) 
~[na:1.6.0_31]
        at java.io.File.createNewFile(File.java:883) ~[na:1.6.0_31]
        at 
org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy.acquireExclusiveReadLock(MarkerFileExclusiveReadLockStrategy.java:54)
 ~[camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin(GenericFileProcessStrategySupport.java:46)
 ~[camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:46)
 ~[camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:308)
 [camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:175)
 [camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:136)
 [camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:140)
 [camel-core-2.9.0.jar:2.9.0]
        at 
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92) 
[camel-core-2.9.0.jar:2.9.0]
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
[na:1.6.0_31]
        at 
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) 
[na:1.6.0_31]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) 
[na:1.6.0_31]
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
 [na:1.6.0_31]
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
 [na:1.6.0_31]
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
 [na:1.6.0_31]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 [na:1.6.0_31]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
[na:1.6.0_31]
        at java.lang.Thread.run(Thread.java:680) [na:1.6.0_31]
{noformat}

I have tried both tried error handling on the route and the DefaultErrorHandler 
way but this exception is never handled by the methods, ie Camel log them and 
then swallow them.

--
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

        

Reply via email to