[CDRIVER-4803] Resolve TSAN warning for multiple single-threaded clients Created: 02/Jan/24 Updated: 08/Jan/24 |
|
| Status: | Backlog |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Kevin Albertson | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
SummaryResolve an observed TSAN warning when using multiple single-threaded clients in separate threads. Here is an example stack trace when used in the C++ driver:
This may require locking gHandshakeLock around calls to _mongoc_handshake_freeze for single-threaded clients. The TSAN warning is currently suppressed in the C driver: https://github.com/mongodb/mongo-c-driver/blob/3f2c35d97e7f12de5da4f049dce4c3f8494aba67/.tsan-suppressions#L2 Background & MotivationI expect the warning is harmless. The TSAN warning is flagging the fact that a global is being overwritten to the same value by two different threads. Using a mongoc_client_pool_t to obtain clients in a multi-threaded application is preferred. This may not be a commonly encountered issue. However, this was observed by an internal team and may serve as a point of confusion. |