[SERVER-77634] withTransaction must yield the session to avoid a deadlock on stepdown Created: 31/May/23 Updated: 01/Jun/23 Resolved: 31/May/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Silvia Surroca | Assignee: | [DO NOT USE] Backlog - Sharding EMEA |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Sharding EMEA
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
Any code running `withTransaction` may end up with a deadlock if the given OperationContext has a SessionId and there is a deadlock during the transaction process. The sequence of events leading to a deadlock is the following:
1. (A) checks out a SessionId withTransaction is a method implemented as a utility for the ShardingCatalogManager when new transactions API didn't exist. The new transaction API yields the session attached to the thread to avoid this scenario. So I suggest getting rid of withTransaction code and using the new transaction API instead. This is an example of implementation for the new transaction API This issue was discovered when the sessionId was attached to the ConfigsvrCollMod request. The sessionId was finally removed to solve quickly the bug. |
| Comments |
| Comment by Silvia Surroca [ 31/May/23 ] |
|
Duplicates |