[CDRIVER-3772] Add checks for use without init or after cleanup Created: 06/Aug/20  Updated: 09/Feb/23

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: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Improve Developer Experience

 Description   

Calling mongoc_cleanup invalidates global state. We've had bug reports caused by applications calling mongoc_cleanup early (e.g. CDRIVER-3674).

Though it may not be possible to reliably check if the global initialization state is valid, checks may still add safety. Namely, we can try to guard against:

1. Calling libmongoc functions after mongoc_cleanup
2. Calling libmongoc functions before mongoc_init

In either of those cases, aborting seems safer than the current undefined behavior.


Generated at Wed Feb 07 21:18:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.