-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
Drop implementations that spawn async tasks (e.g. the drop in cursor executes a killCursors command) can panic if the tokio runtime gets dropped before they execute. This isn't a huge concern because usually the runtime is only dropped on application exit, but we should still try to exit more gracefully if possible.
repro (ensure there are at least two documents):
Unable to find source-code formatter for language: rust. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
#[tokio::main] async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> { let mut options = ClientOptions::parse("mongodb://localhost:27017").await?; let client = Client::with_options(options)?; let options =FindOptions::builder().batch_size(1).build(); client .database("list_collections") .find(doc! {}, options) .await?; Ok(()) }