Stop using MozPromise in the module loader
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox118 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
(Blocks 2 open bugs)
Details
Attachments
(4 files, 2 obsolete files)
There are a few bugs open at the moment concerning memory leaks that look like they might be caused by the module loader. Bug 1811635 is one example, in which mccr8 says:
I'm not sure exactly how the promise ownership chains work, but I'm guessing the basic issue is that mFetchingModules is not being cleared as expected, and the MozPromise can't be cycle collected because it is some fancy threadsafe thing.
MozPromise is indeed not cycle collected. I think the idea is that promises are transient and so this doesn't matter but it is plausible that this is involved somehow.
I originally used MozPromise in the module loader because I thought it would simplify the code and offload a tricky part of the implementation. However this wasn't entirely successful as it's not clear exactly what resolving/rejecting a promise is going to do and it still ended up pretty hard to understand.
Overall I don't think its use adds much to the module loader and therefore I'd like to remove it.
| Assignee | ||
Comment 1•2 years ago
|
||
This replaces the promise with a list of module requests that are waiting for a
resource to be fetched. When the fetch completes the waiting requests are
resumed appropriately. Like MozPromise, this happens via runnables dispatched
to the module loader's event target.
| Assignee | ||
Comment 2•2 years ago
|
||
This replaces the use of a promise to waits for all imports of a module to load
with a counter of reminaing imports in the parent and a pointer to the parent
that is waiting in the child.
Depends on D183272
| Assignee | ||
Comment 3•2 years ago
|
||
This was previously used by MozPromise but is no longer required.
Depends on D183273
| Assignee | ||
Comment 4•2 years ago
|
||
This is no longer necessary since the module loader is now always synchronous.
Depends on D183586
| Assignee | ||
Comment 5•2 years ago
|
||
This fixes two failures that are currently marked as expected to fail.
Depends on D183588
Comment 7•2 years ago
|
||
Backed out for causing failures on js/src/tests/test262/language/*
- backout: https://hg.mozilla.org/integration/autoland/rev/af904f365ca830513f5b003eb6366a360b90365c
- push: https://treeherder.mozilla.org/jobs?repo=autoland&selectedTaskRun=UzU4CA5BRr6SPNBzExjfZg.0&revision=38669a2ddad9d4f3a114933fcf73a6c7438d576c
- failure log: https://treeherder.mozilla.org/logviewer?job_id=422889231&repo=autoland&lineNumber=37242
[task 2023-07-17T17:43:16.717Z] 17:43:16 INFO - REFTEST TEST-START | js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js;module;async
[task 2023-07-17T17:43:16.719Z] 17:43:16 INFO - REFTEST TEST-LOAD | file:///builds/worker/workspace/build/tests/jsreftest/tests/js/src/tests/jsreftest.html?test=test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js;module;async | 7964 / 11170 (71%)
[task 2023-07-17T17:43:16.772Z] 17:43:16 INFO - TEST-INFO | FAILED! InternalError: module record has unexpected status: Evaluating
[task 2023-07-17T17:43:16.883Z] 17:43:16 INFO - REFTEST TEST-UNEXPECTED-FAIL | js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js;module;async | No test results reported. (SCRIPT)
[task 2023-07-17T17:43:16.884Z] 17:43:16 INFO -
[task 2023-07-17T17:43:16.885Z] 17:43:16 INFO - REFTEST TEST-END | js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js;module;async
| Assignee | ||
Comment 8•2 years ago
|
||
Turns out my try pushes didn't run all JS reftests.
| Assignee | ||
Comment 9•2 years ago
|
||
According to spec this should happen asynchronously. If it doesn't it's
possible for the importing module to still be in the evaluating state when
trying to instantiate and evaluate the dynamically imported module which breaks
the module loader invariants.
Depends on D183273
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
Backed out for causing wpt failures in /html/webappapis/dynamic-markup-insertion/document-write/module-dynamic-import.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/99efb2502534907124c554f48f5cea2fb4518d02
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Comment 12•2 years ago
|
||
Comment 13•2 years ago
|
||
Backed out for wpt failures on module-tla-import.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/4f30f034e751998477f7830b9f059374003c324c
Log link: https://treeherder.mozilla.org/logviewer?job_id=424674336&repo=autoland&lineNumber=9336
| Assignee | ||
Updated•2 years ago
|
Comment 14•2 years ago
|
||
Comment 15•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/1642f8c1f603
https://hg.mozilla.org/mozilla-central/rev/7b867fa107f5
https://hg.mozilla.org/mozilla-central/rev/6aaab5ae37f2
https://hg.mozilla.org/mozilla-central/rev/ce70368fe145
Description
•