Skip to content
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

Fix file watching events being lost #12264

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

sgraband
Copy link
Contributor

@sgraband sgraband commented Mar 7, 2023

What it does

Fixed an issue with tracking the current FileSystemEvents in the MainFileSystemEventService.
Before, the events were tracked in a global field which was intended to be cleaned after an onDidFilesChanges() update was sent to the proxy.
This is problematic as we do not await sending the update.
Thus, the global field will be cleaned before the update is even sent and therefore, file watching updates might get lost.
This change ensures that a field of events is kept for each update.

Note that simply awaiting the update to be sent is not enough.
This would introduce race conditions as other parallel updates might clean the state of other updates before they are being sent.

Fixes #12260.

Contributed on behalf of STMicroelectronics

How to test

  1. Install the following extension: file-watching-sample-0.0.1.zip
  2. Change/Add/Delete a file
  3. All actions should be detected by the extension (should display a console log and a information message in Theia)

Review checklist

Reminder for reviewers

Fixed an issue with tracking the current `FileSystemEvents`
in the `MainFileSystemEventService`.
Before, the events were tracked in a global field which was intended to
be cleaned after an `onDidFilesChanges()` update was sent to the proxy.
This is problematic as we do not await sending the update.
Thus, the global field will be cleaned before the update is even sent
and therefore, file watching updates might get lost.
This change ensures that a field of events is kept for each update.

Note that simply awaiting the update to be sent is not enough.
This would introduce race conditions as other parallel updates might
clean the state of other updates before they are being sent.

Fixes eclipse-theia#12260.

Contributed on behalf of STMicroelectronics
Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this also with a largish file delete outside of Theia and works for me.

@tsmaeder tsmaeder merged commit fff63e0 into eclipse-theia:master Mar 10, 2023
@tsmaeder tsmaeder mentioned this pull request Mar 14, 2023
2 tasks
tsmaeder pushed a commit that referenced this pull request Mar 20, 2023
Fixed an issue with tracking the current `FileSystemEvents`
in the `MainFileSystemEventService`.
Before, the events were tracked in a global field which was intended to
be cleaned after an `onDidFilesChanges()` update was sent to the proxy.
This is problematic as we do not await sending the update.
Thus, the global field will be cleaned before the update is even sent
and therefore, file watching updates might get lost.
This change ensures that a field of events is kept for each update.

Note that simply awaiting the update to be sent is not enough.
This would introduce race conditions as other parallel updates might
clean the state of other updates before they are being sent.

Fixes #12260.

Contributed on behalf of STMicroelectronics
@vince-fugnitto vince-fugnitto added this to the 1.36.0 milestone Mar 30, 2023
@vince-fugnitto vince-fugnitto added the file-watchers issues related to filesystem watchers - nsfw label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file-watchers issues related to filesystem watchers - nsfw
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VSCode extension FileSystemWatcher not working since 1.33.0
3 participants