Closed Bug 1823429 Opened 2 years ago Closed 2 years ago

FetchStreamReader causes stack overflow when reading ReadableStream with a large queue

Categories

(Core :: DOM: Streams, defect)

defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox111 --- wontfix
firefox112 --- wontfix
firefox113 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

new Response(new ReadableStream({ start(c) { 

for (const i of new Array(40000).fill()) {
 c.enqueue(new Uint8Array(0));
}
c.close();

} })).text();

FetchStreamReader::ChunkSteps is calling OnOutputStreamReady and that calls ReadableStreamDefaultReader::ReadChunk, which then again can call ChunkSteps synchronously. The stack becomes longer as the queue becomes larger.

See Also: → 1538754
Severity: -- → S2
Priority: -- → P2
Whiteboard: [necko-triaged]

Set release status flags based on info from the regressing bug 1750298

:evilpie, since you are the author of the regressor, bug 1750298, could you take a look?

For more information, please visit auto_nag documentation.

Flags: needinfo?(evilpies)
Component: DOM: Networking → DOM: Streams

I think DOM:Streams should be the correct component.

Severity: S2 → --
Priority: P2 → --
Whiteboard: [necko-triaged]

But shouldn't the chunk length be non-zero and some point after we start reading? I am not sure why we would re-enter so often.

Flags: needinfo?(evilpies)

new Uint8Array(0), that's why.

Severity: -- → S3
Assignee: nobody → krosylight
Attachment #9325395 - Attachment description: WIP: Bug 1823429 - Just proceed when the chunk is empty r=smaug,evilpie → Bug 1823429 - Don't try another read from ChunkSteps r=smaug,evilpie
Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/34e9465f50b6 Don't try another read from ChunkSteps r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/39363 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch

The patch landed in nightly and beta is affected.
:saschanaz, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox112 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(krosylight)

This is quite an edge case that I believe users won't meet in real world. I'll let it ride the train.

Flags: needinfo?(krosylight)
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: