Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18270

IMAP skipFailedMessage=true, but route blocked if mail is moved while download

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.18.0
    • 3.14.5, 3.18.1, 3.19.0
    • camel-mail
    • None
    • Unknown

    Description

       

      Our imap mail route on the production system gets blocked when someone or an other systems moves / deletes an email from the inbox, while the camel mail route is loading the mail. As we do not have full control on the mailboxes we enabled skipFailedMessage but the issue remains.

      The following exception is written is the log, but the mail consumer is blocked. The issue can only be resolved by a restart of the service.

      2022-07-14 09:17:28.714  WARN 5465 --- [fice365.com:993] o.a.c.i.engine.DefaultReactiveExecutor   : Error executing reactive work due to Error accessing headers due to: Cannot load header. This exception is ignored.
      org.apache.camel.RuntimeCamelException: Error accessing headers due to: Cannot load header
          at org.apache.camel.component.mail.MailMessage.populateInitialHeaders(MailMessage.java:107) ~[camel-mail-3.18.0.jar:3.18.0]
          at org.apache.camel.support.DefaultMessage.createHeaders(DefaultMessage.java:331) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.support.DefaultMessage.hasHeaders(DefaultMessage.java:305) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.support.AbstractExchange.copy(AbstractExchange.java:140) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.support.DefaultExchange.copy(DefaultExchange.java:27) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.support.ExchangeHelper.createCopy(ExchangeHelper.java:322) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.defensiveCopyExchangeIfNeeded(RedeliveryErrorHandler.java:304) ~[camel-core-processor-3.18.0.jar:3.18.0]
          at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.prepare(RedeliveryErrorHandler.java:680) ~[camel-core-processor-3.18.0.jar:3.18.0]
          at org.apache.camel.processor.PrototypeTaskFactory.acquire(PrototypeTaskFactory.java:29) ~[camel-core-processor-3.18.0.jar:3.18.0]
          at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:210) ~[camel-core-processor-3.18.0.jar:3.18.0]
          at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:399) ~[camel-base-engine-3.18.0.jar:3.18.0]
          at org.apache.camel.processor.Pipeline$PipelineTask.run(Pipeline.java:109) ~[camel-core-processor-3.18.0.jar:3.18.0]
          at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:189) ~[camel-base-engine-3.18.0.jar:3.18.0]
          at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:61) ~[camel-base-engine-3.18.0.jar:3.18.0]
          at org.apache.camel.processor.Pipeline.process(Pipeline.java:184) ~[camel-core-processor-3.18.0.jar:3.18.0]
          at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:399) ~[camel-base-engine-3.18.0.jar:3.18.0]
          at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83) ~[camel-base-engine-3.18.0.jar:3.18.0]
          at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:41) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:451) ~[camel-mail-3.18.0.jar:3.18.0]
          at org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:260) ~[camel-mail-3.18.0.jar:3.18.0]
          at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:165) ~[camel-mail-3.18.0.jar:3.18.0]
          at org.apache.camel.support.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:202) ~[camel-support-3.18.0.jar:3.18.0]
          at org.apache.camel.support.ScheduledPollConsumer.run(ScheduledPollConsumer.java:116) ~[camel-support-3.18.0.jar:3.18.0]
          at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
          at java.base/java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:305) ~[na:na]
          at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java) ~[na:na]
          at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
          at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
      Caused by: javax.mail.MessagingException: Cannot load header
          at com.sun.mail.imap.IMAPMessage.loadHeaders(IMAPMessage.java:1583) ~[jakarta.mail-1.6.5.jar:1.6.5]
          at com.sun.mail.imap.IMAPMessage.getAllHeaders(IMAPMessage.java:992) ~[jakarta.mail-1.6.5.jar:1.6.5]
          at org.apache.camel.component.mail.MailBinding.extractHeadersFromMail(MailBinding.java:649) ~[camel-mail-3.18.0.jar:3.18.0]
          at org.apache.camel.component.mail.MailMessage.populateInitialHeaders(MailMessage.java:104) ~[camel-mail-3.18.0.jar:3.18.0]
          ... 29 common frames omitted
      

       

      I've reproduced the issue with a break point on MailConsumer.processExchange. When the process hits this break point, I've move the mail and the route was blocked.

      I think the route blocks on DefaultAsyncProcessorAwaitManager.await Line 107, but I'm not sure about it.

      The expected behavior for me with skipFailedMessage=true, would be an ERROR in the log and processing of the next mail.

      Is this a bug or is there a workaround for this issue?

      Maybe this is related with CAMEL-16829

       

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              fibyflo Florian Fiby
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: