Closed Bug 1816388 Opened 2 years ago Closed 2 years ago

Fix unresolved promise when worker shuts down during copying

Categories

(Core :: DOM: File, defect, P3)

defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: jjalkanen, Assigned: jjalkanen)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 4 obsolete files)

In particular on the Macintosh platform, the xpcshell tests for the asynchronous copying method FileSystemWritableFileStream::Write in a worker may have shutdown hangs and/or crashes because a test failure cancels the copying task, and the cancel implementation of nsAsyncStreamCopier does not call the OnStopRequest of its task observer, which should resolve the pending DOM-promise.

Some ways to improve the situation would be to

  • call OnStopRequest in nsAsyncStreamCopier's cancel method
  • keep the worker alive with a strong reference until copying is finished
  • ensure that the promise is not left in pending state when the observer is destroyed

For the record, the issue was discovered and investigated by :janv

Attachment #9317292 - Attachment is obsolete: true
Attached file WIP: Bug 1816388 - Fixes for D169609 (obsolete) —
Attachment #9317295 - Attachment is obsolete: true
Attachment #9317293 - Attachment is obsolete: true
Attachment #9317301 - Attachment description: WIP: Bug 1816388 - Use NS_AsyncCopy directly in FileSystemWritableFileStream::Write. → Bug 1816388 - Use NS_AsyncCopy directly in FileSystemWritableFileStream::Write. r=#dom-storage
Attachment #9317308 - Attachment is obsolete: true

(In reply to Jari Jalkanen from comment #0)

In particular on the Macintosh platform, the xpcshell tests for the asynchronous copying method FileSystemWritableFileStream::Write in a worker may have shutdown hangs and/or crashes because a test failure cancels the copying task, and the cancel implementation of nsAsyncStreamCopier does not call the OnStopRequest of its task observer, which should resolve the pending DOM-promise.

Some ways to improve the situation would be to

  • call OnStopRequest in nsAsyncStreamCopier's cancel method
  • keep the worker alive with a strong reference until copying is finished
  • ensure that the promise is not left in pending state when the observer is destroyed

or we can use NS_AsynCopy directly, the attached patch does exactly that

Pushed by jjalkanen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/073223bab35f Use NS_AsyncCopy directly in FileSystemWritableFileStream::Write. r=dom-storage-reviewers,janv
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
Regressions: 1830197
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: