Sending emails via SSL/TLS stalls forever, fine with STARTTLS
Categories
(Core :: DOM: Networking, defect, P1)
Tracking
()
| Tracking | Status | |
|---|---|---|
| thunderbird_esr153 | --- | unaffected |
| firefox-esr115 | --- | unaffected |
| firefox-esr153 | --- | unaffected |
| firefox161 | --- | unaffected |
| firefox162 | + | affected |
| firefox163 | + | fixed |
People
(Reporter: skyschub, Assigned: valentin, NeedInfo)
References
(Regression)
Details
(Keywords: regression, testcase)
Attachments
(3 files, 2 external files)
|
230.37 KB,
application/zip
|
Details | |
|
573.05 KB,
image/png
|
Details | |
|
2.53 KB,
patch
|
Details | Diff | Splinter Review |
I have noticed that I can no longer send emails over SSL/TLS in Thunderbird beta, while everything is fine in Thunderbird 160 stable. Trying to send an email just results in the "Sending message..." dialog staying on screen forever, with no email actually being sent. Flipping to STARTTLS on another port seems to resolve this issue. Other clients on the same machine have no issue, and can send emails via SSL/TLS on port 465 just fine.
Setting mailnews.smtp.loglevel=All only dumps two lines of logs into the console:
mailnews.smtp: New SmtpClient instance created SmtpClient.sys.mjs:137:17
mailnews.smtp: Connecting to smtp://alpha.0b101010.email:465 SmtpClient.sys.mjs:172:19
I have attached a networking log with MOZ_LOG="timestamp,sync,nsHostResolver:5,GetAddrInfo:5,nsSocketTransport:5,negotiateauth:5" to this bug.
This seems to be a regression between 160 as I can never reproduce this on Release, but can break this all the time in Beta. mozregression gave me this regression range, although I have little confidence in that - it kinda feels wrong?
| Reporter | ||
Comment 1•5 days ago
|
||
Attached is now also a screenshot of a wireshark capture that I decrypted via the keys from SSLKEYLOGFILE.
You can see Thunderbird connecting, the mailserver responding with a greeting, and then... nothing until I eventually gave up on waiting after two minutes and ctrl-c'ed Thunderbird which closed the connection. I can share the raw capture privately if anyone wants to look at that, but I didn't see anything odd.
| Reporter | ||
Updated•5 days ago
|
| Reporter | ||
Updated•5 days ago
|
| Reporter | ||
Updated•5 days ago
|
| Reporter | ||
Comment 3•5 days ago
|
||
Correct, restarting both Thunderbird and the host OS - which I again forgot to mention: macOS 27.2.1 (26B131) - does not fix the issue. I can reproduce this every time in Thunderbird Beta.
It's also not a profile-specific issue, I can reproduce this in a freshly created profile.
| Reporter | ||
Comment 4•5 days ago
|
||
I should also note that this isn't a generic networking issue: inbound mails via IMAP, moving mails around into different folders, all of that works. It's specifically sending that's broken, and also only with SSL/TLS, I have successfully sent several mails with STARTTLS in the last hour.
Updated•4 days ago
|
Comment 5•4 days ago
|
||
Hi all,
this is a very unfortunate regression caused by bug 2061626, which I filed to help us.
It is a race, only happening when the main thread is busy while the TLS handshake completes on the socket thread. TCPSocket then registers its handshake listener too late, HandshakeDone() is never called, and the socket stays in connecting forever without firing open, error or close.
I have a rather nasty, but reliable LLM conjured reproduction that passed before and fails now.
git apply bug2097852-tcpsocket-tls-open-race-test.diff
./mach xpcshell-test netwerk/test/unit/test_tcpsocket_tls_open_race.js
Needinfo to the people involved in the vicinity.
Thunderbird 162 cannot ship with this, a bug 2061626 and bug 2091547 backout may be the saner way than rushing to fix.
Thanks
Max
Updated•4 days ago
|
Comment 6•4 days ago
|
||
Updated•4 days ago
|
Comment 7•3 days ago
|
||
Set release status flags based on info from the regressing bug 2061626
Updated•3 days ago
|
| Assignee | ||
Comment 8•3 days ago
|
||
TCPSocket registers its handshake listener from the main thread once it
receives STATUS_CONNECTED_TO. If the handshake finishes on the socket thread
before that, the listener was never called and the socket stayed in the
connecting state forever.
Updated•3 days ago
|
| Assignee | ||
Comment 9•3 days ago
|
||
Thunderbird 162 cannot ship with this, a bug 2061626 and bug 2091547 backout may be the saner way than rushing to fix.
I think Thunderbird is probably the only user of the TCPSocket API - so that's up to you, if you want to request a backout from beta.
Otherwise I'll focus on a fix to land on Nightly.
Comment 10•3 days ago
|
||
Aside: It would probably be worthwhile to see if Thunderbird can use more of the Gecko network stack rather than having custom code.
| Assignee | ||
Comment 11•3 days ago
|
||
I think the problem is that Gecko doesn't really need TCPSockets speaking random protocols like smtp. Moving the protocol implementations to Gecko is something I'd rather not do. And moving the dom TCPSocket to the thunderbird repo probably wouldn't work too well, since it's tied closely into our networking APIs, so it would break the build every time something changed.
Maybe what we need is the thunderbird tests running in CI for every push as a tier2?
| Assignee | ||
Comment 12•3 days ago
|
||
STATUS_CONNECTED_TO is delivered asynchronously, so it can reach a socket that
was closed while connecting. A secure socket then registered a TLS handshake
listener after CloseHelper() cleared it, and the listener kept the socket alive.
A non-secure socket went back to open and fired an open event.
Comment 13•3 days ago
|
||
(In reply to Lars Eggert [:lars] from comment #10)
Aside: It would probably be worthwhile to see if Thunderbird can use more of the Gecko network stack rather than having custom code.
Yes and no, a shared Happy Eyeballs implementation for example is preferred, but Thunderbird speaking its own protocol implementations on top of TCP in C++, JS and potentially Rust is not going away anytime soon.
Thanks to everyone for the appropriately fast handling.
Comment 14•3 days ago
|
||
Comment 15•3 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d4e72bfd9a85
https://hg.mozilla.org/mozilla-central/rev/f4dfb01bf747
Comment 16•3 days ago
|
||
The patch landed in nightly and beta is affected.
:valentin, please make an uplift decision for beta:
- For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set
status-firefox162towontfixif the fix can wait for the next release.
The bugbug regressor model rates the riskiest of the 2 patches (d4e72bfd9a85) as medium risk: about 7% of the patches with this rating cause a regression. Given the severity of the bug, an uplift is recommended.
Uplift requests can be submitted from Lando: D346780, D346796.
See Requesting an Uplift for documentation on how to request an uplift.
For more information, please visit BugBot documentation.
Comment 17•11 hours ago
|
||
Yes, please uplift to beta
Comment 19•21 minutes ago
|
||
@valentin Will you be putting in an uplift request for beta? If so they will need that soon as the final beta is Wed.
Description
•