Skip to content

fix: reuse sources registered during URL resolution - #2387

Open
Siddharth (sidsri14) wants to merge 1 commit into
microsoft:mainfrom
sidsri14:sidsri14/fix-source-registration-race
Open

fix: reuse sources registered during URL resolution#2387
Siddharth (sidsri14) wants to merge 1 commit into
microsoft:mainfrom
sidsri14:sidsri14/fix-source-registration-race

Conversation

@sidsri14

Copy link
Copy Markdown

Summary

  • recheck the original-URL source registry after asynchronous URL resolution
  • reuse a concurrently registered source only when its content hash matches
  • add a deterministic regression test for the two-context race

Closes #2342

Verification

  • npm run test:unit -- --grep SourceContainer (1 passing)
  • npm run test:types
  • npm run compile
  • dprint check src/adapter/sourceContainer.ts src/adapter/sourceContainer.test.ts
  • eslint --max-warnings=0 src/adapter/sourceContainer.ts src/adapter/sourceContainer.test.ts
  • git diff --check

The full unit run completed with 259 passing tests and 8 failures, all in the unchanged NodeBinaryProvider Windows PATH fixtures, where the host Node executable is selected instead of the checked-in fixture. Full lint likewise reaches an existing dprint violation in unchanged src/targets/node/nodeLauncher.ts:318; the changed files pass both dprint and ESLint directly.

@sidsri14
Siddharth (sidsri14) marked this pull request as ready for review July 27, 2026 13:39
@sidsri14

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sourcemap resolution fails when multiple V8 execution contexts load the same script URL (race condition in addSource)

1 participant