-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Upgrade WebKit to 5488984d: fix require(ESM) diamond-dep deadlock #30527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8d745d2
Upgrade WebKit to 2b6b1c39: fix require(ESM) diamond-dep deadlock (#3…
alii 9aca307
ci: retrigger now that autobuild-preview-pr-225-2b6b1c39 is published
alii 7c5a59d
WEBKIT_VERSION: switch from preview tag to merged sha 5488984d (oven-…
alii 28e69e2
test(30493): use Bun.spawn timeout instead of setTimeout watchdog
robobun 95258bf
test(30493): set explicit 30s test timeout above the 10s spawn timeout
robobun f8ed082
ci: retrigger (Windows test-http-should-emit-close flake, also on #53…
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // https://github.com/oven-sh/bun/issues/30493 | ||
| // | ||
| // `require()` of an ESM module whose graph contains a diamond dependency | ||
| // through a barrel deadlocked (release) / aborted on `ASSERTION FAILED: | ||
| // m_status == Status::Fetching` at ModuleRegistryEntry.cpp:254 (debug). | ||
| // Regressed by the require(esm) sync-replay path; same root cause as | ||
| // #30281 — `moduleRegistryModuleSettled` fired twice for the same entry | ||
| // when `hostLoadImportedModule`'s synchronous-replay branch had already | ||
| // driven `fetchComplete` inline while a stale normal-queue reaction was | ||
| // still pending. Fix: oven-sh/WebKit#225. | ||
| // | ||
| // This is the dependency-free reduction of #30281; it subsumes the | ||
| // react + MUI repro from #30283. | ||
|
|
||
| import { expect, test } from "bun:test"; | ||
| import { bunEnv, bunExe, normalizeBunSnapshot, tempDir } from "harness"; | ||
|
|
||
| test("require() of ESM with diamond dependency through barrel does not deadlock", async () => { | ||
| using dir = tempDir("issue-30493", { | ||
| // shared.js: imports a synthetic builtin so its fetch goes through | ||
| // the normal microtask queue *before* the require(esm) entry point | ||
| // switches to synchronous draining — that ordering is what leaves a | ||
| // stale ModuleRegistryModuleSettled reaction queued. `path.posix.sep` | ||
| // so the snapshot is platform-stable. | ||
| "shared.js": `import path from 'path';\nexport const SHARED = path.posix.sep;\n`, | ||
| "barrel.js": `import { SHARED } from './shared.js';\nexport { SHARED };\nexport const BARREL = 'barrel';\n`, | ||
| "a.js": `import { SHARED } from './barrel.js';\nexport default function a() { return SHARED; }\n`, | ||
| "b.js": `import { BARREL } from './barrel.js';\nexport default function b() { return BARREL; }\n`, | ||
| "app.js": `import a from './a.js';\nimport b from './b.js';\nimport { SHARED } from './shared.js';\nexport default { a: a(), b: b(), shared: SHARED };\n`, | ||
| "entry.js": `const mod = require('./app.js');\nconsole.log(JSON.stringify(mod.default));\n`, | ||
| }); | ||
|
|
||
| await using proc = Bun.spawn({ | ||
| cmd: [bunExe(), "entry.js"], | ||
| cwd: String(dir), | ||
| env: bunEnv, | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| // Before the fix: release builds deadlock indefinitely; debug builds | ||
| // abort. Bound the subprocess so the assertions below show a clear | ||
| // failure instead of the test itself timing out. | ||
| timeout: 10_000, | ||
| }); | ||
|
|
||
| const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); | ||
|
|
||
| expect(normalizeBunSnapshot(stdout, dir)).toMatchInlineSnapshot(`"{"a":"/","b":"barrel","shared":"/"}"`); | ||
| // null ⇒ exited on its own; non-null ⇒ killed by the spawn timeout (deadlocked). | ||
| expect(proc.signalCode).toBeNull(); | ||
| expect(exitCode).toBe(0); | ||
| }, 30_000); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.