Closed Bug 1782415 Opened 2 years ago Closed 2 years ago

TB aborts loading a group if the server returns an incorrect response to an XHDR command

Categories

(MailNews Core :: Networking: NNTP, defect)

Thunderbird 102
defect

Tracking

(thunderbird_esr102+ affected)

RESOLVED FIXED
105 Branch
Tracking Status
thunderbird_esr102 + affected

People

(Reporter: infofrommozilla, Assigned: rnons)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

When filtering on a user-defined header, TB fetches this header from the server using an XHDR command. This has worked so far (before nntp.jsmodule) without problems. With nntp.jsmodule enabled, some groups could no longer be retrieved from my local server.

The primary error is that when a header is folded, my server (Hamster) does not unfold it for the XHDR comand. The C-module just seems to have ignored these erroneous lines. nntp.jsmodule stumbles over these lines, and aborts the download.

Primarily, of course, the server should be fixed. But I think it makes sense to catch the erroneous input in the TB as well.

Keywords: regression
Regressed by: nntp-js
Attached image Good line.

This shows the normal flow:
https://searchfox.org/comm-central/rev/3d8384f4a82ceb53ddaa47415afca30d9c7c9ddf/mailnews/news/src/NntpNewsGroup.jsm#183

The article number is determined from the beginning of the line and the header is then linked to it:

   let msgHdr = this._db.GetMsgHdrForKey(articleNumber);
   msgHdr.setStringProperty(header, value);
Attached image Buggy line

This is what happens if the line is incorrect.

No article number can be determined, whereupon GetMsgHdrForKey(articleNumber); throws an exception:

43.091 NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMsgDatabase.GetMsgHdrForKey] NntpNewsGroup.jsm:187
    processXHdrLine resource:///modules/NntpNewsGroup.jsm:187
    _actionXHdrResponse resource:///modules/NntpClient.jsm:569
    read resource:///modules/LineReader.jsm:51
    _actionXHdrResponse resource:///modules/NntpClient.jsm:566
    _onData resource:///modules/NntpClient.jsm:182```
Assignee: nobody → remotenonsense
Status: NEW → ASSIGNED

I tried to catch processXHdrLine first, then I realized this can happen to other response as well.

        try {
          this._newsGroup.processXHdrLine(this._curXHdrHeader, line);
        } catch (e) {
          this._logger.error(`processXHdrLine failed for "${line}".`, e);
        }

nntp.jsmodule stumbles over these lines, and aborts the download

I'm not sure if my patch fixes your problem. Do you have a dev env to test my patch? Can you explain a bit why this affects downloading? Thanks.

(In reply to Ping Chen (:rnons) from comment #4)

nntp.jsmodule stumbles over these lines, and aborts the download

I'm not sure if my patch fixes your problem. Do you have a dev env to test my patch?

No, just a Daily.

Can you explain a bit why this affects downloading? Thanks.

Except for the exception, nothing happens.
For old groups, no new articles arrive and new or reset groups remain empty.

OK, let's land it first and see.

Target Milestone: --- → 105 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/454fb2cb9cb8
Catch all errors when handling server responses in NntpClient.jsm. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

The error message has changed:

16:08:56.911 mailnews.nntp: Failed to process server response [object Object]. 
Exception { name: "NS_ERROR_ILLEGAL_VALUE", message: "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMsgDatabase.GetMsgHdrForKey]", result: 2147942487, filename: "resource:///modules/NntpNewsGroup.jsm", lineNumber: 187, columnNumber: 0, data: null, stack: "processXHdrLine@resource:///modules/NntpNewsGroup.jsm:187:27\n_actionXHdrResponse/<@resource:///modules/NntpClient.jsm:574:25\nread@resource:///modules/LineReader.jsm:51:19\n_actionXHdrResponse@resource:///modules/NntpClient.jsm:571:22\n_onData@resource:///modules/NntpClient.jsm:183:12\n", location: XPCWrappedNative_NoHelper }
​
columnNumber: 0
​
data: null
​
filename: "resource:///modules/NntpNewsGroup.jsm"
​
lineNumber: 187
​
location: XPCWrappedNative_NoHelper { QueryInterface: QueryInterface(), filename: Getter, name: Getter, … }
​
message: "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMsgDatabase.GetMsgHdrForKey]"
​
name: "NS_ERROR_ILLEGAL_VALUE"
​
result: 2147942487
​
stack: "processXHdrLine@resource:///modules/NntpNewsGroup.jsm:187:27\n_actionXHdrResponse/<@resource:///modules/NntpClient.jsm:574:25\nread@resource:///modules/LineReader.jsm:51:19\n_actionXHdrResponse@resource:///modules/NntpClient.jsm:571:22\n_onData@resource:///modules/NntpClient.jsm:183:12\n"
​
<prototype>: ExceptionPrototype { toString: toString(), name: Getter, message: Getter, … }
NntpClient.jsm:185:20
    _onData resource:///modules/NntpClient.jsm:185
16:08:56.912 mailnews.nntp: Done with status=2147500037 NntpClient.jsm:786:18

But the download is still aborted.

Should probably be uplifted.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: