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

test: fix flaky test-fs-watch-recursive on OS X #9303

Closed
wants to merge 1 commit into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Oct 26, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test fs

Description of change

The test was sometimes timing out due to a race condition. In OS X,
events for fs.watch() might only start showing up after a delay. This
is a limitation of the operating system. To work around that, there was
a timer in the test that delayed the writing of the file by 100ms.
However, sometimes that was not enough, and so the event never fired,
and the test timed out.

Change the timer to an interval so that it fires repeatedly until it is
picked up. This change only affects OS X.

Fixes: #8511

/cc @nodejs/testing

The test was sometimes timing out due to a race condition. In OS X,
events for `fs.watch()` might only start showing up after a delay. This
is a limitation of the operating system. To work around that, there was
a timer in the test that delayed the writing of the file by 100ms.
However, sometimes that was not enough, and so the event never fired,
and the test timed out.

Change the timer to an interval so that it fires repeatedly until it is
picked up. This change only affects OS X.

Fixes: nodejs#8511
@Trott Trott added fs Issues and PRs related to the fs subsystem / file system. test Issues and PRs related to the tests. macos Issues and PRs related to the macOS platform / OSX. labels Oct 26, 2016
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 26, 2016
@Trott
Copy link
Member Author

Trott commented Oct 26, 2016

@gerges-beshay
Copy link

@Trott, what about updating "watcherClosed" to use "let", and "interval" to use "const"?

@Trott
Copy link
Member Author

Trott commented Oct 26, 2016

Linter passed, OS X passed, and Windows passed. The test does not run on any other platforms. So CI looks ✅ as far as relevant results go.

@Trott
Copy link
Member Author

Trott commented Oct 28, 2016

@Trott, what about updating "watcherClosed" to use "let", and "interval" to use "const"?

Not using const for interval because it needs to be used outside the block where it is declared.

I don't a great a reason for avoiding let here, but this is my so-so reason: I generally don't use let because there are situations where it is not performant in V8 with certain types of loops. Rather than having to remember in what situations let is performant, I'm just not using it at all until the performance issues are overcome. Granted, worrying about performance of a boolean in a test is overkill. So... ¯_(ツ)_/¯

Trott added a commit to Trott/io.js that referenced this pull request Oct 29, 2016
The test was sometimes timing out due to a race condition. In OS X,
events for `fs.watch()` might only start showing up after a delay. This
is a limitation of the operating system. To work around that, there was
a timer in the test that delayed the writing of the file by 100ms.
However, sometimes that was not enough, and so the event never fired,
and the test timed out.

Change the timer to an interval so that it fires repeatedly until it is
picked up. This change only affects OS X.

Fixes: nodejs#8511
PR-URL: nodejs#9303
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
@Trott
Copy link
Member Author

Trott commented Oct 29, 2016

Landed in fd54df1

@Trott Trott closed this Oct 29, 2016
evanlucas pushed a commit that referenced this pull request Nov 3, 2016
The test was sometimes timing out due to a race condition. In OS X,
events for `fs.watch()` might only start showing up after a delay. This
is a limitation of the operating system. To work around that, there was
a timer in the test that delayed the writing of the file by 100ms.
However, sometimes that was not enough, and so the event never fired,
and the test timed out.

Change the timer to an interval so that it fires repeatedly until it is
picked up. This change only affects OS X.

Fixes: #8511
PR-URL: #9303
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 22, 2016
The test was sometimes timing out due to a race condition. In OS X,
events for `fs.watch()` might only start showing up after a delay. This
is a limitation of the operating system. To work around that, there was
a timer in the test that delayed the writing of the file by 100ms.
However, sometimes that was not enough, and so the event never fired,
and the test timed out.

Change the timer to an interval so that it fires repeatedly until it is
picked up. This change only affects OS X.

Fixes: #8511
PR-URL: #9303
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
MylesBorins pushed a commit that referenced this pull request Nov 22, 2016
The test was sometimes timing out due to a race condition. In OS X,
events for `fs.watch()` might only start showing up after a delay. This
is a limitation of the operating system. To work around that, there was
a timer in the test that delayed the writing of the file by 100ms.
However, sometimes that was not enough, and so the event never fired,
and the test timed out.

Change the timer to an interval so that it fires repeatedly until it is
picked up. This change only affects OS X.

Fixes: #8511
PR-URL: #9303
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This was referenced Nov 22, 2016
@Trott Trott deleted the fix-flaky-on-osx branch January 13, 2022 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. macos Issues and PRs related to the macOS platform / OSX. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate flaky test-fs-watch-recursive on OS X
6 participants