[SERVER-42971] ThreadClient should restore original thread name on destruction Created: 22/Aug/19 Updated: 29/Oct/23 Resolved: 21/Dec/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.3.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jack Mulrow | Assignee: | Daniel Morilha (Inactive) |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | neweng, save-for-daniel | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Service Arch 2022-1-10 |
| Participants: | |
| Story Points: | 3 |
| Description |
|
ThreadClient is an RAII type that manages a client's lifecycle by instantiating a client on the current thread on construction (through Client::initThread()) and resetting the thread's client on destruction. Instantiating a client will set the thread's name, but ThreadClient does not restore the original thread name, if any, on destruction. This means when ThreadClients are used by threads in a pool, like worked scheduled by a transaction two phase commit coordinator, those threads will have their original names permanently overwritten, leading to misleading log messages when they're later used. |
| Comments |
| Comment by Githook User [ 21/Dec/21 ] |
|
Author: {'name': 'Daniel Vitor Morilha', 'email': 'daniel.morilha@mongodb.com', 'username': 'daniel-mdb'}Message: |
| Comment by Spencer Brody (Inactive) [ 21/Aug/20 ] |
|
Noticed this while investigating a unit test failure. I spent a few minutes being confused about why the thread names being printed didn't seem to correspond to the test I was investigating at all. I think this would be a nice ticket to knock out at some point which would reduce unnecessary confusion when reading logs. Could be a good candidate for a new grad on rotation perhaps? |