You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File service: revisit leaking file handles from error cases causing some of our tests to fail #114024
6398 passing (2m)
19 pending
1 failing
1) Disk File Service
"after each" hook for "readFile - FILE_EXCEEDS_MEMORY_LIMIT - streamed":
Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Three observations:
a failure in a teardown does not benefit from mocha.retry
there is filesystem contention in this rather late fs test. very many tests do not await unlinking and the test suite also does not use graceful-fs.
some tests (e.g. BackupTracker) cause continued FS writing to their fixture folder even after the test has finished, which would trip a simple rimraf with ENOTEMPTY errors.
I am working on a PR to improve reliability in this space.
1) Disk File Service
"after each" hook for "readFile - FILE_EXCEEDS_MEMORY_LIMIT - streamed":
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\VSSADM~1\AppData\Local\Temp\vsctests\diskfileservice\2bb4054d-19d3-4dc3-8c45-ca6172234760'
I find it weird that the fd 3 is closed only after the second open call. It looks like the first await does not actually await for the fd to be closed:
await doTestFileExceedsMemoryLimit();
// Also test when the stat size is wrong
fileProvider.setSmallStatSize(true);
return doTestFileExceedsMemoryLimit();
In that particular test, the statPromise resolves with an error and I believe Promise.all does not really wait for fileStreamPromise. So it looks like in this particular case readFile resolves with an error before having cleaned up the fd fileStreamPromise used.
In other words:
try{awaitservice.readFile(resource,{limits: {memory: 10}});}catch(err){// ---> there is still an open fd to the resource here which is incorrecterror=err;}
This would not help for the unit tests because it all happens async, but at least for normal usage the stream should not be consumed in case we error like that because of file limits.
Digging a bit deeper, it seems the token is respected all the way to here where we open the file handle:
changed the title [-]Flaky test: Disk File Service[/-][+]File service: revisit leaking file handles from error cases causing some of our tests to fail[/+]on Jan 14, 2021
Activity
Use RimRafMode.UNLINK in tests to avoid filesystem contention (#114024)
FS improvements for unit tests (#114026)
bpasero commentedon Jan 8, 2021
Let's see how the latest changes perform.
alexdima commentedon Jan 11, 2021
I haven't seen any test failures in this area in over 100 builds today. I would optimistically close this.
bpasero commentedon Jan 13, 2021
https://dev.azure.com/monacotools/Monaco/_build/results?buildId=100269&view=logs&j=306b2268-2a17-5e97-ab97-f41a26dc5206&t=99b4f36c-57e7-52a9-d2fb-83a564c876a6&l=7673
alexdima commentedon Jan 14, 2021
I've enabled fs logging for that test. The test does the following fs calls, which might be incorrect:
I find it weird that the fd 3 is closed only after the second open call. It looks like the first
awaitdoes not actuallyawaitfor the fd to be closed:alexdima commentedon Jan 14, 2021
The problematic code is here:
vscode/src/vs/platform/files/common/fileService.ts
Line 484 in 7a9bb5a
In that particular test, the statPromise resolves with an error and I believe
Promise.alldoes not really wait forfileStreamPromise. So it looks like in this particular casereadFileresolves with an error before having cleaned up the fdfileStreamPromiseused.In other words:
bpasero commentedon Jan 14, 2021
Alexandru Dima (@alexdima) thanks, this is a nice catch. I think there is 2 questions here:
We actually have a way of cancelling a file open when an error occurs here:
vscode/src/vs/platform/files/common/fileService.ts
Lines 451 to 455 in 22bd999
This would not help for the unit tests because it all happens async, but at least for normal usage the stream should not be consumed in case we error like that because of file limits.
Digging a bit deeper, it seems the token is respected all the way to here where we open the file handle:
vscode/src/vs/platform/files/common/io.ts
Line 59 in 18f33ed
However the fact that we seem to
throwIfCancelledright after without closing that file descriptor seems fishy to me and sounds like a bug.vscode/src/vs/platform/files/common/io.ts
Lines 59 to 62 in 18f33ed
I will look into this closer tomorrow.
[-]Flaky test: Disk File Service[/-][+]File service: revisit leaking file handles from error cases causing some of our tests to fail[/+]