This repository has been archived by the owner on Feb 26, 2020. It is now read-only.
Fix race condition in the linux:shrinker splat test. #196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Linux Shrinker splat test has a race condition.
There is no guarantee that when the call to write "2" to /proc/sys/vm/drop_caches returns that the kernel has called the shrinker which has been defined.
The patch puts a wait event on this so that either the shrinker is run OR a 1 second timeout occurs.
If the timeout occurs then there is some sort of error cause it shouldn't take 1 second for the kernel to run through the shrinker callback.
Once the shrinker has run and shrunk down to 0, then the main test resumes and the race condition is fixed.
The only issue with this fix I can think of is if it is feasible for it to take longer than 1 second to execute, but I don't think that is likely.
It also fixes a small problem in the failsafe code which would trigger if the linux:shrinker test was run multiple times. This changes takes my error rate from about 1 error in runs 6, to 0 in 10,000 runs.
This fixes issues: #182 & #96
It also fixes one of the failures reported in: #125