Getting Exception while imap idle adapter is listening on mail inbox












0















In my project i am using the imap idle channel adapter with following configuration:



@Bean
public IntegrationFlow imapAdapter(MailNotifierProperties properties, SubscribableChannel errorChannel,
SubscribableChannel incomingMailChannel) {
return from(Mail.imapIdleAdapter(properties.getImapUrl())
.javaMailProperties(p -> p
.put("mail.imap.starttls.enable", "true")
.put("mail.imap.ssl.trust", "*"))
.errorChannel(errorChannel)
.shouldDeleteMessages(properties.getDeleteMessages()))
.channel(incomingMailChannel)
.get();
}


The configuration works fine most of the time. But one or two times a day i receive the following exception and the application is not able to process mails for about 30 minutes:



2018-11-18 07:05:45.342  WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter        : error occurred in idle task

javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
... 14 common frames omitted

2018-11-18 07:05:45.343 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
Caused by: javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
... 10 common frames omitted
Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
... 14 common frames omitted

2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : error occurred in idle task

javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
Caused by: javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
... 10 common frames omitted

2018-11-18 07:37:01.872 INFO 19778 --- [TaskScheduler19] o.s.integration.mail.ImapMailReceiver : attempting to receive mail from folder [INBOX]


Right now i have no answers for the following questions
1) What causes the error message: "* NO Mailbox is locked, will abort in 268 seconds"?
2) Why there are no mails processed within the next 30 minutes?



Update:
i have checked the log files on the server, and i could find the following message that occurs at the same time:



Nov  18 07:05:33 MailServer postfix/local[19960]: 5D5AAC20FA: to=<sender@domain.com>, orig_to=<recipient@domain.com>, relay=local, delay=19, delays=0.01/0/0/19, dsn=4.2.0, status=deferred (cannot update mailbox /var/mail/mailUser for user mailUser. unable to lock for exclusive access: Resource temporarily unavailable)


However, the file that locks the mailbox is removed after 30 seconds.



Is there a way to configure the imap channel adapter to reconnect in a shorter period. I still have the problem, that the application waits 30 minutes to reconnect to the mailbox.










share|improve this question





























    0















    In my project i am using the imap idle channel adapter with following configuration:



    @Bean
    public IntegrationFlow imapAdapter(MailNotifierProperties properties, SubscribableChannel errorChannel,
    SubscribableChannel incomingMailChannel) {
    return from(Mail.imapIdleAdapter(properties.getImapUrl())
    .javaMailProperties(p -> p
    .put("mail.imap.starttls.enable", "true")
    .put("mail.imap.ssl.trust", "*"))
    .errorChannel(errorChannel)
    .shouldDeleteMessages(properties.getDeleteMessages()))
    .channel(incomingMailChannel)
    .get();
    }


    The configuration works fine most of the time. But one or two times a day i receive the following exception and the application is not able to process mails for about 30 minutes:



    2018-11-18 07:05:45.342  WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter        : error occurred in idle task

    javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
    at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
    Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
    at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
    ... 14 common frames omitted

    2018-11-18 07:05:45.343 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

    java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
    Caused by: javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
    at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    ... 10 common frames omitted
    Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
    at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
    ... 14 common frames omitted

    2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : error occurred in idle task

    javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
    at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

    2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

    java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
    Caused by: javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
    at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
    at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    ... 10 common frames omitted

    2018-11-18 07:37:01.872 INFO 19778 --- [TaskScheduler19] o.s.integration.mail.ImapMailReceiver : attempting to receive mail from folder [INBOX]


    Right now i have no answers for the following questions
    1) What causes the error message: "* NO Mailbox is locked, will abort in 268 seconds"?
    2) Why there are no mails processed within the next 30 minutes?



    Update:
    i have checked the log files on the server, and i could find the following message that occurs at the same time:



    Nov  18 07:05:33 MailServer postfix/local[19960]: 5D5AAC20FA: to=<sender@domain.com>, orig_to=<recipient@domain.com>, relay=local, delay=19, delays=0.01/0/0/19, dsn=4.2.0, status=deferred (cannot update mailbox /var/mail/mailUser for user mailUser. unable to lock for exclusive access: Resource temporarily unavailable)


    However, the file that locks the mailbox is removed after 30 seconds.



    Is there a way to configure the imap channel adapter to reconnect in a shorter period. I still have the problem, that the application waits 30 minutes to reconnect to the mailbox.










    share|improve this question



























      0












      0








      0








      In my project i am using the imap idle channel adapter with following configuration:



      @Bean
      public IntegrationFlow imapAdapter(MailNotifierProperties properties, SubscribableChannel errorChannel,
      SubscribableChannel incomingMailChannel) {
      return from(Mail.imapIdleAdapter(properties.getImapUrl())
      .javaMailProperties(p -> p
      .put("mail.imap.starttls.enable", "true")
      .put("mail.imap.ssl.trust", "*"))
      .errorChannel(errorChannel)
      .shouldDeleteMessages(properties.getDeleteMessages()))
      .channel(incomingMailChannel)
      .get();
      }


      The configuration works fine most of the time. But one or two times a day i receive the following exception and the application is not able to process mails for about 30 minutes:



      2018-11-18 07:05:45.342  WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter        : error occurred in idle task

      javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
      Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
      ... 14 common frames omitted

      2018-11-18 07:05:45.343 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

      java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
      Caused by: javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      ... 10 common frames omitted
      Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
      ... 14 common frames omitted

      2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : error occurred in idle task

      javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
      at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

      2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

      java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
      Caused by: javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
      at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      ... 10 common frames omitted

      2018-11-18 07:37:01.872 INFO 19778 --- [TaskScheduler19] o.s.integration.mail.ImapMailReceiver : attempting to receive mail from folder [INBOX]


      Right now i have no answers for the following questions
      1) What causes the error message: "* NO Mailbox is locked, will abort in 268 seconds"?
      2) Why there are no mails processed within the next 30 minutes?



      Update:
      i have checked the log files on the server, and i could find the following message that occurs at the same time:



      Nov  18 07:05:33 MailServer postfix/local[19960]: 5D5AAC20FA: to=<sender@domain.com>, orig_to=<recipient@domain.com>, relay=local, delay=19, delays=0.01/0/0/19, dsn=4.2.0, status=deferred (cannot update mailbox /var/mail/mailUser for user mailUser. unable to lock for exclusive access: Resource temporarily unavailable)


      However, the file that locks the mailbox is removed after 30 seconds.



      Is there a way to configure the imap channel adapter to reconnect in a shorter period. I still have the problem, that the application waits 30 minutes to reconnect to the mailbox.










      share|improve this question
















      In my project i am using the imap idle channel adapter with following configuration:



      @Bean
      public IntegrationFlow imapAdapter(MailNotifierProperties properties, SubscribableChannel errorChannel,
      SubscribableChannel incomingMailChannel) {
      return from(Mail.imapIdleAdapter(properties.getImapUrl())
      .javaMailProperties(p -> p
      .put("mail.imap.starttls.enable", "true")
      .put("mail.imap.ssl.trust", "*"))
      .errorChannel(errorChannel)
      .shouldDeleteMessages(properties.getDeleteMessages()))
      .channel(incomingMailChannel)
      .get();
      }


      The configuration works fine most of the time. But one or two times a day i receive the following exception and the application is not able to process mails for about 30 minutes:



      2018-11-18 07:05:45.342  WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter        : error occurred in idle task

      javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
      Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
      ... 14 common frames omitted

      2018-11-18 07:05:45.343 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

      java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
      Caused by: javax.mail.MessagingException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3201) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:3043) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2995) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:175) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      ... 10 common frames omitted
      Caused by: com.sun.mail.iap.CommandFailedException: * NO Mailbox is locked, will abort in 268 seconds
      at com.sun.mail.iap.Protocol.handleResult(Protocol.java:396) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.protocol.IMAPProtocol.processIdleResponse(IMAPProtocol.java:3225) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.handleIdle(IMAPFolder.java:3173) ~[javax.mail-1.5.5.jar!/:1.5.5]
      ... 14 common frames omitted

      2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : error occurred in idle task

      javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
      at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) [spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

      2018-11-18 07:36:51.824 WARN 19778 --- [TaskScheduler19] o.s.i.mail.ImapIdleChannelAdapter : Failed to execute IDLE task. Will attempt to resubmit in 10000 milliseconds.

      java.lang.IllegalStateException: Failure in 'idle' task. Will resubmit.
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:290) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$ReceivingTask.run(ImapIdleChannelAdapter.java:241) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_121]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
      Caused by: javax.mail.FolderClosedException: * BYE Disconnected for inactivity.
      at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:3601) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:3737) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:583) ~[javax.mail-1.5.5.jar!/:1.5.5]
      at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:299) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapMailReceiver.waitForNewMessages(ImapMailReceiver.java:158) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      at org.springframework.integration.mail.ImapIdleChannelAdapter$IdleTask.run(ImapIdleChannelAdapter.java:271) ~[spring-integration-mail-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
      ... 10 common frames omitted

      2018-11-18 07:37:01.872 INFO 19778 --- [TaskScheduler19] o.s.integration.mail.ImapMailReceiver : attempting to receive mail from folder [INBOX]


      Right now i have no answers for the following questions
      1) What causes the error message: "* NO Mailbox is locked, will abort in 268 seconds"?
      2) Why there are no mails processed within the next 30 minutes?



      Update:
      i have checked the log files on the server, and i could find the following message that occurs at the same time:



      Nov  18 07:05:33 MailServer postfix/local[19960]: 5D5AAC20FA: to=<sender@domain.com>, orig_to=<recipient@domain.com>, relay=local, delay=19, delays=0.01/0/0/19, dsn=4.2.0, status=deferred (cannot update mailbox /var/mail/mailUser for user mailUser. unable to lock for exclusive access: Resource temporarily unavailable)


      However, the file that locks the mailbox is removed after 30 seconds.



      Is there a way to configure the imap channel adapter to reconnect in a shorter period. I still have the problem, that the application waits 30 minutes to reconnect to the mailbox.







      spring-integration javamail






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 4 '18 at 6:46







      domenic_K

















      asked Nov 22 '18 at 12:56









      domenic_Kdomenic_K

      647




      647
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The message is coming from your mail server so you need to ask the owner of your mail server, or if it's your own mail server you need to look into the log files to see why it's complaining about the mailbox being locked. Perhaps two applications are trying to access the same mailbox and the mail server isn't able to handle more than one application accessing the mailbox at a time?






          share|improve this answer
























          • Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

            – domenic_K
            Dec 4 '18 at 6:48











          • The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

            – Bill Shannon
            Dec 4 '18 at 18:41











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431549%2fgetting-exception-while-imap-idle-adapter-is-listening-on-mail-inbox%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The message is coming from your mail server so you need to ask the owner of your mail server, or if it's your own mail server you need to look into the log files to see why it's complaining about the mailbox being locked. Perhaps two applications are trying to access the same mailbox and the mail server isn't able to handle more than one application accessing the mailbox at a time?






          share|improve this answer
























          • Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

            – domenic_K
            Dec 4 '18 at 6:48











          • The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

            – Bill Shannon
            Dec 4 '18 at 18:41
















          0














          The message is coming from your mail server so you need to ask the owner of your mail server, or if it's your own mail server you need to look into the log files to see why it's complaining about the mailbox being locked. Perhaps two applications are trying to access the same mailbox and the mail server isn't able to handle more than one application accessing the mailbox at a time?






          share|improve this answer
























          • Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

            – domenic_K
            Dec 4 '18 at 6:48











          • The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

            – Bill Shannon
            Dec 4 '18 at 18:41














          0












          0








          0







          The message is coming from your mail server so you need to ask the owner of your mail server, or if it's your own mail server you need to look into the log files to see why it's complaining about the mailbox being locked. Perhaps two applications are trying to access the same mailbox and the mail server isn't able to handle more than one application accessing the mailbox at a time?






          share|improve this answer













          The message is coming from your mail server so you need to ask the owner of your mail server, or if it's your own mail server you need to look into the log files to see why it's complaining about the mailbox being locked. Perhaps two applications are trying to access the same mailbox and the mail server isn't able to handle more than one application accessing the mailbox at a time?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 22:51









          Bill ShannonBill Shannon

          23.4k43032




          23.4k43032













          • Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

            – domenic_K
            Dec 4 '18 at 6:48











          • The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

            – Bill Shannon
            Dec 4 '18 at 18:41



















          • Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

            – domenic_K
            Dec 4 '18 at 6:48











          • The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

            – Bill Shannon
            Dec 4 '18 at 18:41

















          Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

          – domenic_K
          Dec 4 '18 at 6:48





          Hi, i have updated my question. The mailbox is locked and so the application fails to request mails.

          – domenic_K
          Dec 4 '18 at 6:48













          The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

          – Bill Shannon
          Dec 4 '18 at 18:41





          The code that gets the MessagingException will need to disconnect and reconnect. That may be deep inside the Spring framework code, which I don't know anything about.

          – Bill Shannon
          Dec 4 '18 at 18:41


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431549%2fgetting-exception-while-imap-idle-adapter-is-listening-on-mail-inbox%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen