Closed Bug 1941210 Opened 9 days ago Closed 7 days ago

`new Response(new ReadableStream()).text()` can be aborted too soon by cycle collection

Categories

(Core :: DOM: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox-esr128 --- fixed
firefox134 --- fixed
firefox135 --- fixed
firefox136 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [necko-triaged], [wptsync upstream])

Attachments

(3 files, 1 obsolete file)

var i = 0;
await new Response(new ReadableStream({
  pull(c) {
    if (i >= 1000) {
      c.close();
      return;
    }
    ++i;
    c.enqueue(new Uint8Array([0]))
    TestUtils.gc(); // enabled with dom.testing.testutils.enabled=true
  }
})).arrayBuffer();

Expected: An ArrayBuffer with size 1000
Actual on Nightly: An ArrayBuffer with size 1

This is a kinda edge case where the stream is owned only by itself and nobody else. I don't know why anyone would do this rather than purely for testing. (Thus S4 while P2 because it's regression.)

Nothing is strongly holding FetchStreamReader while waiting for OutputStreamHolder. Might want to have a temporary strong reference just as we have mAsyncWaitWorkerRef right now. (And thanks to mAsyncWaitWorkerRef this works fine on workers)

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

Whiteboard: [necko-triaged]

Nothing strongly grabs ReadableStream nor FetchStreamReader while waiting for nsIAsyncOutputStream to respond. mAsyncWaitReader should now strongly grab the reader until the output stream responds.

Pushed by krosylight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f4e3877220b1 Strongly grab FetchStreamReader while waiting for writing r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/50077 for changes under testing/web-platform/tests
Whiteboard: [necko-triaged] → [necko-triaged], [wptsync upstream]
Status: NEW → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
Upstream PR merged by moz-wptsync-bot

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-firefox135 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(krosylight)

Nothing strongly grabs ReadableStream nor FetchStreamReader while waiting for nsIAsyncOutputStream to respond. mAsyncWaitReader should now strongly grab the reader until the output stream responds.

Original Revision: https://phabricator.services.mozilla.com/D234031

Attachment #9459632 - Flags: approval-mozilla-beta?
Flags: in-testsuite+

beta Uplift Approval Request

  • User impact if declined: In an edge case one may get incomplete result when consuming a stream
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: N/A
  • Risk associated with taking this patch: Low
  • Explanation of risk level: Minimal changes
  • String changes made/needed: No
  • Is Android affected?: yes
Flags: needinfo?(krosylight)
Attachment #9459632 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
See Also: → 1942573
Blocks: 1942573
See Also: 1942573

We got a real world report of this regression in bug 1942573.

Nothing strongly grabs ReadableStream nor FetchStreamReader while waiting for nsIAsyncOutputStream to respond. mAsyncWaitReader should now strongly grab the reader until the output stream responds.

Original Revision: https://phabricator.services.mozilla.com/D234031

Attachment #9460495 - Flags: approval-mozilla-release?

Nothing strongly grabs ReadableStream nor FetchStreamReader while waiting for nsIAsyncOutputStream to respond. mAsyncWaitReader should now strongly grab the reader until the output stream responds.

Original Revision: https://phabricator.services.mozilla.com/D234031

Attachment #9460498 - Flags: approval-mozilla-esr128?

Kagami, if we need to uplift a patch to all of our branches, I think the severity of this bug shouldn't be an S4.

Is the new revision you created just a copy of the patch that was already uplifted to beta? (seems to me at first sight), if so I can manually graft it to mozilla-release and carry over the existing reviewer.

Flags: needinfo?(krosylight)

Let's make it S3. Yes, it's just the same patch, cleanly grafted.

Severity: S4 → S3
Flags: needinfo?(krosylight)

Comment on attachment 9460495 [details]
Bug 1941210 - Strongly grab FetchStreamReader while waiting for writing r=smaug,jesup

Functional regression in 134, approved for 134.0.2, thanks.

Attachment #9460495 - Flags: approval-mozilla-release? → approval-mozilla-release+

Kagami, could you provide a release note summarizing the issue please?
You can look at past release notes as a template: https://www.mozilla.org/en-US/firefox/134.0.1/releasenotes/
Thanks

Flags: needinfo?(krosylight)

How about "Fixed an issue where data consumption from service workers may unexpectedly halt."

While technically this doesn't only affect service worker, for now that's the only reported real world case.

Flags: needinfo?(krosylight)
Attachment #9460495 - Flags: approval-mozilla-release+ → approval-mozilla-release?
Attachment #9460495 - Attachment is obsolete: true
Attachment #9460495 - Flags: approval-mozilla-release? → approval-mozilla-release-
Attachment #9460498 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: