[SERVER-50240] Make CurOp::_numYields atomic Created: 10/Aug/20  Updated: 29/Oct/23  Resolved: 12/Aug/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Justin Seyster Assignee: Justin Seyster
Resolution: Fixed Votes: 0
Labels: qexec-team, thread-sanitizer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2020-08-24
Participants:
Linked BF Score: 50

 Description   

The '_numYields' field gets updated in a single thread, but other threads can read it via $currentOp. These reads can trigger appear as data races in TSAN and are technically undefined behavior. Making '_numYields' atomic silences the TSAN errors and gives us reasonable behavior for the purposes of $currentOp.



 Comments   
Comment by Andrew Morrow (Inactive) [ 12/Aug/20 ]

justin.seyster, agreed. Very close. There are three active TSAN build failures that we are tracking before we can expand coverage beyond just jsCore.

  • SERVER-49371, which only affects unit tests, and has an LGTM'd code review so should go in soon.
  • SERVER-49874, also in code review but needs a little more work, hopefully landing soon. We can't suppress our way out of it though, so this is maybe the biggest blocker.
  • SERVER-48490, no motion towards a solution yet, but in the worst case we can suppress the report.

Thanks for getting the CurOp issues sorted out.

Comment by Justin Seyster [ 12/Aug/20 ]

I think we're really close on TSAN now. The only failure in my patch build was the map-reduce recursion one.

Comment by Githook User [ 12/Aug/20 ]

Author:

{'name': 'Justin Seyster', 'email': 'justin.seyster@mongodb.com', 'username': 'jseyster'}

Message: SERVER-50240 Make CurOp::_numYields atomic
Branch: master
https://github.com/mongodb/mongo/commit/fa9e65944ee087a2e86341892311c6c630a8a9e3

Generated at Thu Feb 08 05:22:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.