Skip to content

Random AuthenticationFailedException when connecting via pop3s to outlook.office365.com #164

@vmanu80

Description

@vmanu80

For the past couple of weeks, it has been happening very frequently that the call to the method jakarta.mail.Store.connect("outlook.office365.com", 995, mailUser, token);
triggers the mail.pop3s.writetimeout (set to 30 seconds) with the following exception:

::: AuthenticationFailedException stackTrace ::: jakarta.mail.AuthenticationFailedException: Cannot read field "ok" because "this.resp" is null
at org.eclipse.angus.mail.pop3.POP3Store.protocolConnect(POP3Store.java:194)
at jakarta.mail.Service.connect(Service.java:345)
...

Enabling debug mode, I get this error:

DEBUG: getProvider() returning jakarta.mail.Provider[STORE,pop3s,org.eclipse.angus.mail.pop3.POP3SSLStore,Oracle]
DEBUG POP3: mail.pop3s.rsetbeforequit: false
DEBUG POP3: mail.pop3s.disabletop: false
DEBUG POP3: mail.pop3s.forgettopheaders: false
DEBUG POP3: mail.pop3s.cachewriteto: false
DEBUG POP3: mail.pop3s.filecache.enable: false
DEBUG POP3: mail.pop3s.keepmessagecontent: false
DEBUG POP3: mail.pop3s.starttls.enable: true
DEBUG POP3: mail.pop3s.starttls.required: false
DEBUG POP3: mail.pop3s.finalizecleanclose: false
DEBUG POP3: mail.pop3s.apop.enable: false
DEBUG POP3: mail.pop3s.disablecapa: false
DEBUG POP3: connecting to host "outlook.office365.com", port 995, isSSL true
+OK The Microsoft Exchange POP3 service is ready.
CAPA
+OK
TOP
UIDL
SASL PLAIN XOAUTH2
USER
.
DEBUG POP3: Attempt to authenticate using mechanisms: XOAUTH2
DEBUG POP3: Using mechanism XOAUTH2
DEBUG POP3: AUTH XOAUTH2 command trace suppressed
DEBUG POP3: mail.pop3s.auth.xoauth2.two.line.authentication.format: true
DEBUG POP3: AUTH XOAUTH2 using two line authentication format
DEBUG POP3: AUTH XOAUTH2 failed, THROW:
java.io.EOFException: Read timed out
at org.eclipse.angus.mail.pop3.Protocol.readResponse(Protocol.java:1223)
at org.eclipse.angus.mail.pop3.Protocol.simpleCommand(Protocol.java:1164)
at org.eclipse.angus.mail.pop3.Protocol.twoLinesCommand(Protocol.java:1184)
at org.eclipse.angus.mail.pop3.Protocol.access$900(Protocol.java:72)
at org.eclipse.angus.mail.pop3.Protocol$OAuth2Authenticator.runAuthenticationCommand(Protocol.java:723)
at org.eclipse.angus.mail.pop3.Protocol$Authenticator.authenticate(Protocol.java:496)
at org.eclipse.angus.mail.pop3.Protocol.authenticate(Protocol.java:321)
at org.eclipse.angus.mail.pop3.POP3Store.authenticate(POP3Store.java:433)
at org.eclipse.angus.mail.pop3.POP3Store.getPort(POP3Store.java:287)
at org.eclipse.angus.mail.pop3.POP3Store.protocolConnect(POP3Store.java:192)
at jakarta.mail.Service.connect(Service.java:345)
.....

I'm using the latest versions of Jakarta Mail and Angus.

I have Java processes that call the connect method every 30 seconds. Lately, the above error occurs about once an hour across different Exchange tenants.

In previous years, when issues like this arose, I always resolved them by updating the JavaMail jars. This is the first time it’s happening with Jakarta Mail and Angus. Is a new version expected to be released to fix this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions