fix(64450): clear the pending program update timer when a watch program is closed - #64587
DevPadawan (skywalkersPadawan) wants to merge 1 commit into
Conversation
…r when a watch program is closed
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
|
|
@microsoft-github-policy-service agree |
|
We're definitely not going to be backporting this or releasing 6.0. |
Fixes #64450
Analysis
createWatchProgram().close()did not clear the pendingtimerToUpdateProgram.When a watched file changed shortly before
close(), the 250 msprogram-update timer could still fire after the watch program was closed.
The callback could then synchronize the program and recreate file
watchers, leaving the Node.js process alive.
Fix
Clear
timerToUpdateProgramincreateWatchProgram().close()beforeclearing the resolution cache and closing the remaining watchers.
Added a
watchAPIregression test that changes a watched file, closesthe watch program before the queued update runs, drains the queued
timeout callbacks, and verifies that the pending update is cleared and
the watchers remain deleted.
Validation
npx hereby runtests --tests="clears the pending program update"— 1 passingwatchAPIsuite:npx hereby runtests --tests="watchAPI"— 43 passingnpx hereby local— passednpx hereby runtests-parallel— 106,371 passingruntests-parallelalso reported an unrelated lint error in anuntracked generated file under
tsc/testdata/fixtures/compiler/.The generated
tsc/directory was removed afterward and is not partof this PR.
AI assistance
ChatGPT was used for investigating the issue, identifying the relevant code paths, and finding the relevant files to work on. Cursor was used with its review agent to perform an implementation check. I manually implemented the fix and regression test, reviewed all resulting diffs, and understood the implementation. I would be happy to discuss the changes and provide additional details about the fix if needed.