-
Bug
-
Resolution: Fixed
-
Low
-
8.5.18, 9.2.5, 8.5.24, 9.5.1
-
2
-
Severity 3 - Minor
-
40
-
Issue Summary
Thread could stuck indefinitely while connecting to mail account when using IMAPS protocol. The problem is caused by incorrect session configuration for IMAP over SSL protocol.
When plugin creates javax.mail.Session it should pass properties mail.imaps.timeout and mail.imaps.connectiontimeout to set socket read timeout and socket connection timeout for IMAPS protocol. At the moment we only pass properties mail.imap.timeout and mail.imap.connectiontimeout which are used for IMAP protocol, but not for IMAPS protocol. In official com.sun.mail.imap package documentation it's mentioned that properties should have prefix mail.imaps.* for IMAPS protocol instead of mail.imap.* which is mentioned everywhere by default.
Note: I wasn't able to reproduce the issue on our side, but based on code analysis from the case reported by customer I could say how the problem could occur.
Steps to Reproduce
- Configured mail account in space for the Mail Archives feature via OAuth 2.0.
- Mail Archiving account polling job will run periodically and if there are connection issues when Confluence starts reading information on socket, the thread could stuck there indefinitely.
Expected Results
Connection is established and data is read from the mail account
Actual Results
The thread will indefinitely stuck on socketRead. If we collect thread dumps from the instance we could see such thread log:
"Caesium-1-4" daemon prio=5 tid=0x00000000000000fb nid=0 runnable java.lang.Thread.State: RUNNABLE at java.base@11.0.20/java.net.SocketInputStream.socketRead0(Native Method) at java.base@11.0.20/java.net.SocketInputStream.socketRead(Unknown Source) at java.base@11.0.20/java.net.SocketInputStream.read(Unknown Source) at java.base@11.0.20/java.net.SocketInputStream.read(Unknown Source) at java.base@11.0.20/sun.security.ssl.SSLSocketInputRecord.read(Unknown Source) at java.base@11.0.20/sun.security.ssl.SSLSocketInputRecord.readHeader(Unknown Source) at java.base@11.0.20/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(Unknown Source) at java.base@11.0.20/sun.security.ssl.SSLSocketImpl.readApplicationRecord(Unknown Source) at java.base@11.0.20/sun.security.ssl.SSLSocketImpl$AppInputStream.read(Unknown Source) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:102) at java.base@11.0.20/java.io.BufferedInputStream.fill(Unknown Source) at java.base@11.0.20/java.io.BufferedInputStream.read(Unknown Source) - locked <0x0000000034cadd7c> (a java.io.BufferedInputStream) at com.sun.mail.iap.ResponseInputStream.readResponse(ResponseInputStream.java:79) at com.sun.mail.iap.Response.<init>(Response.java:109) at com.sun.mail.imap.protocol.IMAPResponse.<init>(IMAPResponse.java:36) at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:388) at com.sun.mail.iap.Protocol.command(Protocol.java:370) - locked <0x00000000549058c7> (a com.sun.mail.imap.protocol.IMAPProtocol) at com.sun.mail.imap.protocol.IMAPProtocol.capability(IMAPProtocol.java:194) at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:119) at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:739) at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:674) - locked <0x000000002c2088dd> (a com.sun.mail.imap.IMAPSSLStore) at javax.mail.Service.connect(Service.java:342) - locked <0x000000002c2088dd> (a com.sun.mail.imap.IMAPSSLStore) at javax.mail.Service.connect(Service.java:222) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.getStore(DefaultMailAccountManager.java:299) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.retrieveMessages(DefaultMailAccountManager.java:153) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:137) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:99) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.pollAllSpaces(DefaultMailAccountManager.java:271) at com.atlassian.confluence.mail.archive.jobs.MailPollJob.lambda$runJob$0(MailPollJob.java:30) at com.atlassian.confluence.mail.archive.jobs.MailPollJob$$Lambda$5759/0x0000000844077840.doInTransaction(Unknown Source) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21) at com.atlassian.sal.spring.component.SpringHostContextAccessor.lambda$doInTransaction$0(SpringHostContextAccessor.java:70) at com.atlassian.sal.spring.component.SpringHostContextAccessor$$Lambda$2035/0x000000084206f040.doInTransaction(Unknown Source) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) at com.atlassian.sal.spring.component.SpringHostContextAccessor.doInTransaction(SpringHostContextAccessor.java:68) at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18) at jdk.internal.reflect.GeneratedMethodAccessor270.invoke(Unknown Source) at java.base@11.0.20/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base@11.0.20/java.lang.reflect.Method.invoke(Unknown Source) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy278.execute(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor270.invoke(Unknown Source) at java.base@11.0.20/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base@11.0.20/java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:241) at com.sun.proxy.$Proxy2869.execute(Unknown Source) at com.atlassian.confluence.mail.archive.jobs.MailPollJob.runJob(MailPollJob.java:29) at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.doRunJob(JobRunnerWrapper.java:121) at com.atlassian.confluence.impl.schedule.caesium.JobRunnerWrapper.runJob(JobRunnerWrapper.java:83) at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134) at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106) at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:464) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:431) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:409) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$$Lambda$3832/0x0000000843842840.accept(Unknown Source) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35) at java.base@11.0.20/java.lang.Thread.run(Unknown Source) Locked ownable synchronizers: - java.util.concurrent.locks.ReentrantLock$NonfairSync@5630f50a - java.util.concurrent.locks.ReentrantLock$NonfairSync@3473f38d
Workaround
Unfortunately there are no system properties available to workaround this issue. Confluence instance restart could help, but problem could occur again if connection is not reliable.
- mentioned in
-
Page Loading...