make sure to unsubscribe from file events#929
Merged
dbaeumer merged 1 commit intomicrosoft:mainfrom May 9, 2022
Merged
Conversation
0995cf7 to
0754a0c
Compare
dbaeumer
approved these changes
May 6, 2022
Member
|
@aeschli , can you have a look as well. |
aeschli
approved these changes
May 6, 2022
Contributor
|
@heejaechang Did you file a bug against vscode as well? |
Contributor
Author
|
@aeschli is it a bug for vscode? I don't see any other code that use Event class remembers all subscription made to the event and dispose them when event itself is disposed. instead, all other case, each caller that calls so, it seems fs watcher behavior around event is just normal pattern for vscode? you can search for |
Contributor
Author
|
is there something I need to do to be checked in? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I looked through vscode's code base and It doesn't look like
fileSystemWatcher.dispose()throughdisposables.push(fileSystemWatcher);will unsubscribe each file watch subscription.each must be disposed individually by
this.hookListeners(fileSystemWatcher, watchCreate, watchChange, watchDelete, **disposables**);like howregisterRawdoes.here are relevant code in vscode
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostFileSystemEventService.ts#L22
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostFileSystemEventService.ts#L91
https://github.com/microsoft/vscode/blob/main/src/vs/base/common/event.ts#L617
https://github.com/microsoft/vscode/blob/main/src/vs/base/common/event.ts#L681
https://github.com/microsoft/vscode/blob/main/src/vs/base/common/lifecycle.ts#L356
basically, no one is calling dispose on listener.subscription which is disposable returned by fileWatcher.onXXX call.