fix: Prevent FileSystemWatcher leak in RooIgnoreController #4233
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.
PR for RooIgnoreController FileSystemWatcher Leak (RooIgnoreController_41)
This PR addresses the
FileSystemWatcherleak associated withRooIgnoreControlleras identified inleak-report/guaranteed/RooIgnoreController_41.md.Description
RooIgnoreControllerinstances, created byTaskobjects, manage aFileSystemWatcher. If aTaskis not properly disposed of (i.e.,Task.abortTask()or a newTask.dispose()method isn't called reliably), theRooIgnoreController'sdisposemethod isn't called, leading to itsFileSystemWatcherleaking.This patch focuses on ensuring the
Taskclass has a robustdisposemethod that cleans up itsRooIgnoreController, and thatTask.abortTask()reliably calls thisdisposemethod.Related Bug Report
Closes: #4232
Changes
dispose()method insrc/core/task/Task.tsto explicitly callthis.rooIgnoreController?.dispose().Task.abortTask()calls the new/augmentedthis.dispose()method.ClineProvider.removeClineFromStack()correctly callstask.abortTask()ortask.dispose().TaskandRooIgnoreController.How to Test
Taskinstances are created and then their parentClineProvideris disposed of or individual tasks are removed from the stack.RooIgnoreController.dispose()is called for eachRooIgnoreControllerinstance associated with a cleaned-upTask.FileSystemWatchercallbacks if test components are involved.Important
Fixes
FileSystemWatcherleak inRooIgnoreControllerby ensuringTask.dispose()is called for cleanup inTask.ts.FileSystemWatcherleak inRooIgnoreControllerby ensuringdispose()is called.Task.dispose()method inTask.tsnow cleans upRooIgnoreControllerand other resources.Task.abortTask()inTask.tscallsdispose()to ensure cleanup.RooIgnoreController.dispose()is called whenTaskis disposed or aborted.FileSystemWatcherduring tests.This description was created by
for f826ade. You can customize this summary. It will automatically update as commits are pushed.