[SERVER-68286] Avoid lifetime issues with mongo::mozjs::kCurrentScope Created: 26/Jul/22 Updated: 29/Oct/23 Resolved: 18/Jan/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.3.0-rc0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Mohammad Dashti (Inactive) | Assignee: | Mohammad Dashti (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 | ||||
| Sprint: | QE 2022-09-19, QE 2022-10-03, QE 2022-10-17, QE 2022-10-31, QE 2022-11-14, QE 2022-11-28, QE 2022-12-12, QE 2022-12-26, QE 2023-01-09, QE 2023-01-23 | ||||
| Participants: | |||||
| Linked BF Score: | 0 | ||||
| Description |
|
First, a `thread_local` storage object like this
should be disqualified from being called a k- constant as it has a subtle and dynamic lifecycle. Second, the only use of this variable is as the returned pointer from getThreadScope.
`scope` goes out of scope after this statement. No more statements in enclosing block. One solution is to convert the thread_local to a class that has a definite destructor, similar to how it's done for ThreadName and the same technique should work here. |
| Comments |
| Comment by Githook User [ 22/Nov/22 ] |
|
Author: {'name': 'Mohammad Dashti', 'email': 'mdashti@gmail.com', 'username': 'mdashti'}Message: |