-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
name: Bug Report
description: Undisposed FileSystemWatcher in RooIgnoreController via Task lifecycle
labels: ["bug", "memory-leak", "guaranteed", "core", "auto-generated"]
Thanks for your report! Please check existing issues first:
👉 https://github.com/RooCodeInc/Roo-Code/issues
App Version
N/A (Static Analysis - Detected in RooIgnoreController_41)
API Provider
Not Applicable / Other
Model Used
N/A (Core Extension Service - Task/IgnoreController)
🔁 Steps to Reproduce
- Setup: Roo Code VS Code extension is active.
- Exact actions:
- A
Taskinstance is created (e.g., by user interaction or an internal process). - The
Taskconstructor instantiatesRooIgnoreController, which in turn callssetupFileWatcherand creates avscode.workspace.createFileSystemWatcher. - The
Taskinstance is later dereferenced or the extension deactivates withoutTask.abortTask()(or an equivalentdisposemethod that handlesRooIgnoreController) being called or completing successfully. This could happen ifClineProvider.removeClineFromStackorClineProvider.disposehas an issue.
- A
- What happened after each step:
- If
Task.abortTask()(which callsthis.rooIgnoreController?.dispose()) is not executed for theTaskinstance, theRooIgnoreController'sdisposemethod is not called. - Consequently, the
FileSystemWatchercreated byRooIgnoreControllerremains active and undisposed. - This leads to a resource leak, as the watcher continues to consume system resources.
- If
💥 Outcome Summary
Expected FileSystemWatcher instances created by RooIgnoreController (within a Task) to be reliably disposed of when the Task's lifecycle ends. However, if the Task's cleanup (via abortTask or a dedicated dispose method) is bypassed or fails, the watcher leaks.
📄 Relevant Logs or Errors (Optional)
Summary:
The
RooIgnoreControllerclass creates avscode.workspace.createFileSystemWatcherin itssetupFileWatchermethod. This watcher is correctly added to an internalthis.disposablesarray, and theRooIgnoreController.dispose()method iterates through this array to dispose of the watcher.
Instances ofRooIgnoreControllerare created within the constructor of theTaskclass. TheTaskclass has anabortTaskmethod which callsthis.rooIgnoreController?.dispose().
A leak is guaranteed if aTaskinstance is created but itsabortTaskmethod ... is not called or does not complete successfully before theTaskinstance itself is dereferenced or the extension deactivates.
The core issue is the FileSystemWatcher created in src/core/ignore/RooIgnoreController.ts around line 41, which may not be disposed if the owning Task is not properly cleaned up.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status