https://bugs.kde.org/show_bug.cgi?id=520672
Russ Hay <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Akonadi IMAP resource does |Akonadi IMAP resource does |not use IMAP IDLE - new |not use IMAP IDLE for |emails only on |Gmail/XOAUTH2 accounts |IntervalCheckTime poll | --- Comment #1 from Russ Hay <[email protected]> --- Additional debugging update: I locally rebuilt `kdepim-runtime` with diagnostic logging added to `ImapResourceBase::startIdleIfNeeded()`, `ImapResourceBase::startIdle()` and `ImapResourceBase::onIdleCollectionFetchDone()`. This showed that the IDLE code path is reached, but `startIdle()` returns before creating the `ImapIdleManager` because `settings()->mustFetchPassword()` is true: ```text IDLE DEBUG: startIdleIfNeeded entered, m_idle = QObject(0x0) IDLE DEBUG: startIdleIfNeeded calling startIdle() IDLE DEBUG: startIdle entered IDLE DEBUG: capabilities = QList(... "IDLE" ...) IDLE DEBUG: mustFetchPassword = true IDLE DEBUG: startIdle returning, mustFetchPassword is true ``` This is with a Gmail / Google Workspace IMAP account using XOAUTH2: ```ini [network] ImapServer=imap.gmail.com Authentication=9 UserName=<redacted> ``` The resource has already authenticated successfully and can fetch mail manually / on interval, so the account is usable. However, because `mustFetchPassword()` remains true, IDLE startup is suppressed. As a test, I locally patched `startIdle()` to log `mustFetchPassword() == true` but continue instead of returning. With that change, the idle collection is resolved and `ImapIdleManager` is created: ```text IDLE DEBUG: mustFetchPassword = true IDLE DEBUG: startIdle returning, mustFetchPassword is true but continue for debug IDLE DEBUG: IdleRidPath = QList("/INBOX", "imap://<redacted>@imap.gmail.com/") IDLE DEBUG: fetching IDLE collection, remoteId = "/INBOX" parent remoteId = "imap://<redacted>@imap.gmail.com/" IDLE DEBUG: onIdleCollectionFetchDone entered, error = 0 errorString = "" IDLE DEBUG: fetched collections count = 1 IDLE DEBUG: creating ImapIdleManager for collection 14 "INBOX" "/INBOX" IDLE DEBUG: ImapIdleManager created ``` After that, with polling disabled, new mail was received through IDLE: ```text IDLE stats received: KIMAP::IdleJob(...) "INBOX" 11921 -1 Starting retrieval for "INBOX" Unhandled response: "* 11921 EXISTS " Incrementally fetching new messages ``` The message then appeared in KMail without waiting for the polling interval. So the issue appears to be more specific than “IDLE does not work”: for XOAUTH2 Gmail accounts, `settings()->mustFetchPassword()` remains true even after successful authentication, and that prevents `ImapResourceBase::startIdle()` from starting `ImapIdleManager`. A possible fix may be to avoid using `mustFetchPassword()` as a hard blocker for IDLE when the resource/session is already authenticated or able to obtain an XOAUTH2 token. At minimum, logging around this early return would make the failure much easier to diagnose. -- You are receiving this mail because: You are watching all bug changes.
