[SERVER-70264] Thread-unsafe use of serverGlobalParams Created: 06/Oct/22 Updated: 29/Oct/23 Resolved: 12/Oct/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.2.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Matt Diener (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Sprint: | Service Arch 2022-10-17 | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 144 | ||||||||||||
| Description |
|
Hot BF caused by TSAN correctly detecting a data race https://jira.mongodb.org/browse/BF-26570 From Slack: It's just a struct with no synchronization other than what its data members provide for themselves. The place at which the ProfileCmdBase sets these parameters is a sync violation. The rules for serverGlobalParams are laid out in the .cpp file (it really belongs in the header):
Well that's not the whole truth if the ProfileCmd is monkeying with the value. I'd say it's a bug in ProfileCmd that it changes the value of the serverGlobalParams struct without a synchronization fence. It only changes slowMS and sampleRate, so it's not such a big deal to make those Atomic, but I would say that serverGlobalParams should probably obey its docs and never change after the command line is interpreted. Code that relies on those two fields should instead invoke accessor functions. Those functions can get their values in a threadsafe manner by consulting the immutable serverGlobalParams as well as an "optional override variable" that's written to by ProfileCmd. ProfileCmd is not the only violator. I think it's just the most recent to be caught by TSAN. |
| Comments |
| Comment by Githook User [ 12/Oct/22 ] |
|
Author: {'name': 'Matt Diener', 'email': 'matt.diener@mongodb.com', 'username': 'mattdiener'}Message: |