Closed Bug 1893307 Opened 10 months ago Closed 9 months ago

POP3 with lots of messages on server gets stuck inside LineReader.sys.jsm doing spinEventLoopUntilEmpty() and times out

Categories

(MailNews Core :: Networking: POP, defect)

Thunderbird 115
x86_64
Windows 11
defect

Tracking

(thunderbird_esr115 wontfix, thunderbird127 fixed)

RESOLVED FIXED
128 Branch
Tracking Status
thunderbird_esr115 --- wontfix
thunderbird127 --- fixed

People

(Reporter: gds, Assigned: gds)

References

Details

Attachments

(1 file, 2 obsolete files)

Bug 1875633 added sending NOOPs to avoid server timeouts when dealing with server responses with lot of "lines" of data. But recently I've noticed that this doesn't always help and NOOPs are never sent because code goes into this and may never come out:
https://searchfox.org/comm-central/rev/769985a1e178315c97985c1374c0e45f1bdb5ee9/mailnews/base/src/LineReader.sys.mjs#67-70

I've noticed this a lot while testing Bug 1847137 when I've shutdown TB while selected on the "root" of a POP3 account with 35k messages on the server. I then start TB and check for new messages (f5) on that POP3 account while seeing in "preview/thread" pane only some account info. Since POP3 logging is enabled and I'm running a debug build started from a terminal, I can see that LIST command is sent and the response comes in but no further activity occurs until a timeout messages pops up (this is after the typical 1 minute timeout allowed by POP3 servers). Also, no NOOP is sent during this time.

This is consistent over many TB startups.

But I notice that while waiting for the LIST processing to finish, if I click inside the "preview/thread" pane or do any other UI activity that a NOOP is sent and the LIST processing quickly completes and then the UIDL processing starts and is received. In a similar way, the UIDL processing hangs and can be "un-hanged" by doing some UI activity. Actually, the UIDL processing, after triggering the LIST processing to finish, does finish without additional UI activity.

When I comment out these lines:
https://searchfox.org/comm-central/rev/769985a1e178315c97985c1374c0e45f1bdb5ee9/mailnews/base/src/LineReader.sys.mjs#67-70
and rebuild and do the same things, there is no hang processing the LIST and UIDL responses.

Magnus suggested changing this to use "setTimeout" here bug 1875633 comment 51 which was tried then but the bug reporter didn't see that it made a difference. However, from what I can tell, completely removing these 4 lines fixes the problem I'm reporting here and I don't see any UI response issues with this gone. This conditional call to spinEventLoopUntilEmpty was put in pre-supernova (toward the end of 102) when apparently UI code had lower "priority" and it was easier to block the UI with mail protocol/network activities. It appears that now, with supernova changes, the UI is more likely to block the mail protocol (e.g., fast scrolling using scroll bar will completely stop network sending).

Assignee: nobody → gds
Status: NEW → ASSIGNED
Attachment #9402031 - Attachment is obsolete: true

With 38k message on POP3 server, setTimeout occurs 33 times during
LIST and 33 times during UIDL line processing with this change.
No observable UI slowdown is detected with loop count at 1000.

Pushed by daniel@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/4a6272605636
Avoid POP3 server timeout processing LIST and UIDL lines. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED

This is causing perma oranges for at least
comm/mailnews/news/test/unit/test_nntpGroupPassword.js
comm/mailnews/news/test/unit/test_xover.js
comm/mailnews/news/test/unit/test_server.js

Flags: needinfo?(gds)
Target Milestone: --- → 128 Branch

Note: This change was put into the main comment 2 commit.
Avoid test error "FAIL - A promise chain failed to handle a
rejection" due to LineReader function "read()" now async.
In NntpClient.sys.mjs don't use runningUri when it is null..

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #9402644 - Attachment is obsolete: true
Flags: needinfo?(gds)

Pushed by alessandro@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/18b7b86cd412
Avoid POP3 server timeout processing LIST and UIDL lines. r=mkmelin,babolivier

Status: REOPENED → RESOLVED
Closed: 9 months ago9 months ago
Resolution: --- → FIXED

Comment on attachment 9402034 [details]
Bug 1893307 - Avoid POP3 server timeout processing LIST and UIDL lines. r=mkmelin

[Triage Comment]
Approved for beta

Attachment #9402034 - Flags: approval-comm-beta+
See Also: → 1869297
See Also: 1869297
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: