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

investigate flaky test-fs-watch-file-enoent-after-deletion #21692

Closed
Trott opened this issue Jul 6, 2018 · 7 comments
Closed

investigate flaky test-fs-watch-file-enoent-after-deletion #21692

Trott opened this issue Jul 6, 2018 · 7 comments
Labels
flaky-test Issues and PRs related to the tests with unstable failures on the CI. fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.

Comments

@Trott
Copy link
Member

Trott commented Jul 6, 2018

  • Version: 11.0.0-pre (master)
  • Platform: win10 vs2017
  • Subsystem: test

https://ci.nodejs.org/job/node-test-binary-windows/18408/COMPILED_BY=vs2017,RUNNER=win10,RUN_SUBSET=3/console

13:48:22 not ok 561 sequential/test-fs-watch-file-enoent-after-deletion
13:48:22   ---
13:48:22   duration_ms: 0.668
13:48:22   severity: fail
13:48:22   exitcode: 1
13:48:22   stack: |-
13:48:22     assert.js:80
13:48:22       throw new AssertionError(obj);
13:48:22       ^
13:48:22     
13:48:22     AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
13:48:22     + expected - actual
13:48:22     
13:48:22     - 0
13:48:22     + 1
13:48:22         at StatWatcher.<anonymous> (c:\workspace\node-test-binary-windows\test\sequential\test-fs-watch-file-enoent-after-deletion.js:46:10)
13:48:22         at StatWatcher.<anonymous> (c:\workspace\node-test-binary-windows\test\common\index.js:467:15)
13:48:22         at StatWatcher.emit (events.js:182:13)
13:48:22         at StatWatcher.onchange (internal/fs/watchers.js:47:8)
13:48:22   ...
@Trott Trott added fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform. flaky-test Issues and PRs related to the tests with unstable failures on the CI. labels Jul 6, 2018
@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

Looks to be a race condition between watchFile() and setTimeout().

@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

Reproducible if you put the call to watchFile() in a timer such that it gets executed after setTimeout().

@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

(fs.watchfile() is synchronous, but probably the underlying operating system watch stuff it depends on is not?)

@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

@nodejs/platform-windows @nodejs/fs @nodejs/testing

@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

This has, unsurprisingly, come up before:

f1c890afb05
#13800 especially #13800 (comment)
#14010

@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

OK, now I think I have a fix...

@Trott
Copy link
Member Author

Trott commented Jul 6, 2018

Hopeful fix: #21694

@Trott Trott closed this as completed in 8c305e1 Jul 14, 2018
targos pushed a commit that referenced this issue Jul 14, 2018
The regression that test-fs-watch-file-enoent-after-deletion was written
to test for involves whether or not the callback runs or not. Checking
what the file watcher reports unfortunately is subject to race
conditions on Windows (and possibly elsewhere) because the file watcher
returns control to the event loop before it may be receiving data from
the OS. So remove those assertions. The test still checks what it is
supposed to check, but is no longer subject to race conditions.

Fixes: #21692

PR-URL: #21694
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Issues and PRs related to the tests with unstable failures on the CI. fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

1 participant