MINOR: Less restrictive assertion in flaky BufferPool test#5799
MINOR: Less restrictive assertion in flaky BufferPool test#5799ijuma merged 4 commits intoapache:trunkfrom
Conversation
|
@smccauliff @lindong28 @becketqin can one of you review this? |
|
Thanks for the PR @colinhicks. What is the actual value of |
|
When the test fails, the value of |
ijuma
left a comment
There was a problem hiding this comment.
Thanks for the PR, left a couple of comments.
| assertTrue("Allocation should finish not much later than maxBlockTimeMs", endTimeMs - beginTimeMs < maxBlockTimeMs + 1000); | ||
| long durationMs = Time.SYSTEM.milliseconds() - beginTimeMs; | ||
| assertTrue("TimeoutException should not throw before maxBlockTimeMs", durationMs >= maxBlockTimeMs); | ||
| assertTrue("TimeoutException should throw soon after maxBlockTimeMs", durationMs < maxBlockTimeMs + 100); |
There was a problem hiding this comment.
You made this stricter (+100 instead of +1000), I'd not do that given Jenkins variability.
| } catch (TimeoutException e) { | ||
| // this is good | ||
| } | ||
| assertTrue("available memory" + pool.availableMemory(), pool.availableMemory() >= 9 && pool.availableMemory() <= 10); |
There was a problem hiding this comment.
Instead of removing this, we should probably just say assert that it can be from 8 to 10 with a comment saying that thread scheduling sometimes means that no deallocation happens by the time we get here.
| assertTrue("available memory" + pool.availableMemory(), pool.availableMemory() >= 9 && pool.availableMemory() <= 10); | ||
| long endTimeMs = Time.SYSTEM.milliseconds(); | ||
| assertTrue("Allocation should finish not much later than maxBlockTimeMs", endTimeMs - beginTimeMs < maxBlockTimeMs + 1000); | ||
| // Thread scheduling sometimes means that no deallocation happens by this point |
There was a problem hiding this comment.
Sorry, my bad, but we should probably say that deallocation varies instead of "no deallocation". 8 implies that at least one of them happened.
|
Thanks for the review and comments @ijuma. I also updated the PR title and description to match the changes you suggested. |
|
Perfect, thanks. |
|
@ijuma Sorry, I didn't notice your message previously. |
Decrease the lower bound for expected available memory, as thread scheduling entails that a variable amount of deallocation happens by the point of assertion. Also make minor clarifications to test logic and comments. The passing rate improved from 98% to 100% locally after these changes (100+ runs). Reviewers: Ismael Juma <ismael@juma.me.uk> ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes)
Decrease the lower bound for expected available memory, as thread scheduling entails that a variable amount of deallocation happens by the point of assertion. Also make minor clarifications to test logic and comments. The passing rate improved from 98% to 100% locally after these changes (100+ runs). Reviewers: Ismael Juma <ismael@juma.me.uk> ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes)
|
Merged to trunk, 2.1 and 2.0 branches. |
Decrease the lower bound for expected available memory, as thread scheduling entails that a variable amount of deallocation happens by the point of assertion. Also make minor clarifications to test logic and comments. The passing rate improved from 98% to 100% locally after these changes (100+ runs). Reviewers: Ismael Juma <ismael@juma.me.uk> ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes)
We are routinely seeing CI failures from an assertion in
testBlockTimeout(), which relies on the interaction between (de)allocations against a producer BufferPool, across multiple threads. I reproduced the failed assertion in my local build at a rate of 2% (N=100):Here's a summary of the test history:
This patch decreases the lower bound for expected available memory, as thread scheduling entails that a variable amount of deallocation happens by the point of assertion.
The patch also makes minor clarifications to test logic and comments. On my machine, it has a 100% passing rate (N=500).
Committer Checklist (excluded from commit message)