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

libflux/test: Fix race in stat watcher test #2177

merged 4 commits into from Jun 4, 2019


Copy link

commented Jun 4, 2019

This PR fixes issue #997, test failure was due to race in test. The stat watcher test performs a append & unlink and wants the stat watcher to detect both changes. However, the append + unlink can occur in between polling loops of the stat watcher, thus the append can be missed. The solution was to add a state variable that would not unlink the file until the stat watcher noticed the file size change from the append.

This PR also reverts 7a319e3, which
temporarily disabled the test due to it failing so much.

Ran through travis several times before fix and hit the issue many times. After the fix, ran through travis 3 times and never hit the problem again.

chu11 added 4 commits Jun 3, 2019
Revert 7a319e3, run test everytime
instead of skipping.
Rename stattimer_ctx to stat_ctx and move some globals into it.
Rename some enums appropriately for change.
Stat watcher test can be racy, where a append + unlink can occur
in between polling stat() checks.  Thus the test that sees a file
size change can be missed.

Add a STAT_WAIT state, which will ensure the unlink does not occur
until after the file size change has been seen.

Fixes #997

This comment has been minimized.

Copy link

commented Jun 4, 2019

I have a question about why libev isn't using inotify, but this PR handily fixes the test in question so nice work and merging.

@grondo grondo merged commit 2cd7a38 into flux-framework:master Jun 4, 2019
4 checks passed
4 checks passed
Summary 1 potential rule
codecov/patch Coverage not affected when comparing 36b02be...71a8537
codecov/project 80.46% (+<.01%) compared to 36b02be
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.