Skip to content

fix: Undisposed FileSystemWatcher in WorkspaceTracker (WorkspaceTracker_45) #4236

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

Closed
kiwina opened this issue Jun 2, 2025 · 0 comments · Fixed by #4237
Closed

fix: Undisposed FileSystemWatcher in WorkspaceTracker (WorkspaceTracker_45) #4236

kiwina opened this issue Jun 2, 2025 · 0 comments · Fixed by #4237
Assignees
Labels
bug Something isn't working Issue - In Progress Someone is actively working on this. Should link to a PR soon.

Comments

@kiwina
Copy link

kiwina commented Jun 2, 2025


name: Bug Report
description: Undisposed FileSystemWatcher in WorkspaceTracker
labels: ["bug", "memory-leak", "guaranteed", "integrations", "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 WorkspaceTracker_45)

API Provider

Not Applicable / Other

Model Used

N/A (Core Extension Service - WorkspaceTracker)

🔁 Steps to Reproduce

  1. Setup: Roo Code VS Code extension is active, and a workspace is open.
  2. Exact actions:
    • A WorkspaceTracker instance is created (typically by ClineProvider).
    • The WorkspaceTracker constructor calls registerListeners, which creates a vscode.workspace.createFileSystemWatcher("**") and adds it to an internal disposables array.
    • The WorkspaceTracker instance is later disposed of (e.g., when its owning ClineProvider is disposed).
  3. What happened after each step:
    • The WorkspaceTracker.dispose() method is called.
    • Currently, this dispose method only clears updateTimer and resetTimer. It does not iterate through the disposables array to call dispose() on the FileSystemWatcher.
    • The FileSystemWatcher remains active, listening to all file events in the workspace, even though the WorkspaceTracker is no longer in use.

💥 Outcome Summary

Expected the FileSystemWatcher created by WorkspaceTracker to be disposed of when the WorkspaceTracker instance itself is disposed. However, the dispose method is incomplete, leading to the watcher leaking and continuing to consume resources.

📄 Relevant Logs or Errors (Optional)

Summary from leak-report/guaranteed/WorkspaceTracker_45.md:

The WorkspaceTracker class initializes a vscode.workspace.createFileSystemWatcher("**") in its registerListeners method. This watcher is added to the this.disposables array. However, the dispose method of WorkspaceTracker only clears this.updateTimer and this.resetTimer. It does not iterate over this.disposables to dispose of the FileSystemWatcher.

The issue is in src/integrations/workspace/WorkspaceTracker.ts where the dispose method does not clean up all disposables.

@dosubot dosubot bot added the bug Something isn't working label Jun 2, 2025
@daniel-lxs daniel-lxs added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 2, 2025
@daniel-lxs daniel-lxs moved this from Triage to Issue [In Progress] in Roo Code Roadmap Jun 3, 2025
@hannesrudolph hannesrudolph added Issue - In Progress Someone is actively working on this. Should link to a PR soon. and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 3, 2025
@github-project-automation github-project-automation bot moved this from Issue [In Progress] to Done in Roo Code Roadmap Jun 4, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Issue - In Progress Someone is actively working on this. Should link to a PR soon.
Projects
Status: Done
3 participants