-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
FileResource sometimes triggers incorrect contents change events #14021
Comments
Hi @Hanksha. Thanks for catching this. Could you describe a bit what you think is going wrong and how your changes fix the problem? |
Hi @tsmaeder Writing/updating a file via
The problem is that between step 2 and 3, the That is why adding a lock fixes the issue. It prevents the |
So if I understand correctly, this does not require an interaction with a third party system (compiler, etc.), but with only Theia itself handling the file if the timing/ordering is right, correct? |
Yes that's correct. |
I'll add this one to #13192 as a reliability issue. I don't see this problem, so I assumed it's low frequency, right? I would therefore classify it as low prio, though. |
And of course, feel free to open a PR if you feel so inclined. |
Yes it can be low frequency, I guess it depends on the machine, we've had a few users experienced it regularly though. I'll contribute a PR for this. |
event during writing Add a lock to the write operation so that checking if the file is synced must wait for the write operation to be done. Fixes eclipse-theia#14021 Contributed on behalf of Toro Cloud Signed-off-by: Vivien Jovet <[email protected]>
Bug Description:
The
FileResource
sometimes triggers incorrect contents change events because the resource is somehow out of sync during file saving.I initially found about it in our own Theia based application which has custom editors using the Theia filesystem API (FileResource, FileService etc.) during end to end tests and some user reports, I was then able to reproduce it by running Theia itself in a playwright test since it takes a bunch of iterations to trigger it.
Steps to Reproduce:
I've recording a GIF of that issue being reproduced:
Additional Information
I tried to run the test with those changes:
It seems to have fixed the problem, could it be a race condition? Maybe the change event is received by the
FileResource
before thefileService.update
orfileService.write
resolves so that the version (which includesmtime
) is updated.The text was updated successfully, but these errors were encountered: