[SERVER-74812] Fix assertion on failpoint hit count in fle2_contention_delete.js Created: 13/Mar/23  Updated: 29/Oct/23  Resolved: 14/Mar/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Erwin Pe Assignee: Erwin Pe
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-75649 Fix failpoint assertions in fle2 cont... Closed
Backwards Compatibility: Fully Compatible
Sprint: Security 2023-03-20
Participants:
Linked BF Score: 35

 Description   

The assertion that the failpoint hit count be exactly 2 in fle2_contention_delete.js should be loosened to be "at least" 2. This is because even if the failpoint is set with

 {mode: {times: 2}} 

, the actual counter that tracks the number of times this failpoint is hit may end up being greater than 2.



 Comments   
Comment by Erwin Pe [ 13/Mar/23 ]

As for why the hit count may exceed 2, it's because this hit count can potentially be incremented in both the shouldFail() check and in the pauseWhileSet() call, and a thread may still increment the hit count even if another thread has already disabled the failpoint. The order of events needed to make this happen is:

  1. T1 calls shouldFail() -> calls _evaluateByMode() -> _modeValue decremented from 2 to 1 -> hit count incremented to 1
  2. T1 calls pauseWhileSet(), -> calls _evaluateByMode()
  3. T2 calls shouldFail() -> calls _evaluateByMode()
  4. T1 (in _evaluateByMode()) decrements _modeValue to 0, disabling the failpoint -> hit count incremented to 2
  5. T2 (also in _evaluateByMode()) decrements _modeValue to -1, disabling the failpoint -> hit count incremented to 3
Generated at Thu Feb 08 06:28:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.