[CSHARP-2203] SynchronizationContext.Current bleed Created: 27/Feb/18 Updated: 26/Nov/18 Resolved: 26/Nov/18 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Write Operations |
| Affects Version/s: | 2.5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Steven [X] | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | deadlock, security, threading | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows server |
||
| Attachments: |
|
| Description |
|
1. In one independent thread, context, uses a AsyncHelper.RunSync(...) wrapper invoke mongodb's UpdateOneAsync method. 2. In another completely independent thread/context, executing following code: These 2 calls not related to each other. This is not 100% time happening. But when happen, it causes deadlock, or potential security issue as it leaks SynchronizationContext. The code of AsyncHelper is attached. |
| Comments |
| Comment by Robert Stam [ 12/Oct/18 ] |
|
The C# driver does not use use SynchronizationContext and never sets it. I don't think this issue is C# driver related. |
| Comment by Steven [X] [ 27/Feb/18 ] |
|
Currently, it only happens when we uses AsyncHelper, as we don't set SynchronizationContext elsewhere. |