Bug 456923 - Outgoing e-mail from GMail account to smtp.gmail.com sometimes hangs
Summary: Outgoing e-mail from GMail account to smtp.gmail.com sometimes hangs
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: Mail Dispatcher Agent (show other bugs)
Version: 5.20.3
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-19 15:16 UTC by Freek de Kruijf
Modified: 2022-12-01 12:25 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Freek de Kruijf 2022-07-19 15:16:54 UTC
SUMMARY
***
Sometimes messages with sender my gmail.com account hangs in the outbox of Local Folders
***

STEPS TO REPRODUCE
1.  Compose a message with my gmail.com address as sender
2.  Submit it for delivery
3.  It does hangs in the outbox of the Local Folders without a warning
4.  When restarting KMail somewhat later a message arrives that sending has failed because the remote host closed the connection.
5.  A workaround is to use "akonadictl stop" to kill all akonadi processes and to restart akonadi in Kmail. After that  most of the time a message appears about a DBUS something is not present or ready. This is not very important. Clicking right on the outgoing mailbox and choosing Send messages in queue makes the hanging message to be delivered.

OBSERVED RESULT
Message hannging.

EXPECTED RESULT
Messages should be delivered immediately or later automatically.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: kernel 5.18.9
(available in About System)
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
Advanced settings of send information for GMail: STARTTLS, port 587, Authentication XOAUTH2
Comment 1 Marc Cousin 2022-09-30 15:00:01 UTC
Don't really know what to say, I've got the exact same problem.
5.25.5 on archlinux.

Usually, the first mail I send works ok, at least if that's shortly after a new plasma session. But if I try to send another one after a while, this one will hang until I restart akonadi.

Is there some information that can be provided ?
Comment 2 Freek de Kruijf 2022-10-17 16:05:14 UTC
Still present in:
Linux/KDE Plasma: kernel 6.0.1
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99.0
Qt Version: 6.4.0
Comment 3 malcolm macleod 2022-11-21 06:46:04 UTC
I have to restart akonadictl every time I want to send an email out of kmail from one of my gmail accounts. This is a usability nightmare.
Is there any info that can be given to get this resolved?
Comment 4 Fabian Vogt 2022-11-24 07:47:55 UTC
Git commit d677a08c21fd99e7e8be0a0899f797f9237207e4 by Fabian Vogt.
Committed on 22/11/2022 at 07:19.
Pushed by fvogt into branch 'release/22.12'.

Don't cache promises for AccountManager::findAccount

Unlike AccountManager::getAccount and AccountManager::refreshTokens, this
method does not return an authenticated account. However, the promises are
cached for all of them in the same store, so it was possible for a call to
e.g. refreshTokens to get a promise created by findAccount instead, resulting
in an unexpected result. Just don't cache promises created by findAccount.
Related: bug 406839, bug 409122, bug 421664

M  +18   -20   src/core/accountmanager.cpp

https://invent.kde.org/pim/libkgapi/commit/d677a08c21fd99e7e8be0a0899f797f9237207e4
Comment 5 Fabian Vogt 2022-12-01 12:25:08 UTC
Git commit 7b2a5ccea0c54b81245acdbbea77a13e570bba2b by Fabian Vogt.
Committed on 01/12/2022 at 12:12.
Pushed by fvogt into branch 'release/22.12'.

SmtpJob: Fix use of KCompositeJob

SmtpJob overrides slotResult, but this had two issues. First, it connected
to LoginJob::result itself, though addJob already does that. Second, in two
cases it did not remove finished jobs from the list of subjobs, leading to
dangling pointers and messing up state. This was most likely only reached
in the case of an expired XOAUTH2 access_token and caused the job to fail
after a successful refresh.
Related: bug 406839, bug 409122, bug 421664

M  +2    -2    src/kmailtransport/plugins/smtp/smtpjob.cpp

https://invent.kde.org/pim/kmailtransport/commit/7b2a5ccea0c54b81245acdbbea77a13e570bba2b