You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Rust are you using? rustup 1.27.1 (2024-04-24)
What operating system are you using? OS X - Sonoma 14.4.1
What versions of the driver and its dependencies are you using? registry+https://github.com/rust-lang/crates.io-index#[email protected] and registry+https://github.com/rust-lang/crates.io-index#[email protected]
What version of MongoDB are you using? Mongo Atlas 7.0.11 ( free tier )
What is your MongoDB topology (standalone, replica set, sharded cluster, serverless)? sharded cluster,
Describe the bug
I have a repository trait that use on services via transaction, here is my code
when I was using the function above on non looping case, it was works well, but when I have loop case which mutable the transactional, and then got error from db ( specially validation, I accidentally made it error to see the bug ) it was stuck / hang, I tried log in Err but it was not received on there
is that any way to handle auto abort transactional without call abort_transaction() ?
is that something wrong with code because I did wrong way to use that transaction ??
at the end function above, I commit the transition like this IF not error ( but in fact the code not arrive on here yet , because the code above was bug )
pubfncommit_transaction(transactional:Option<Transactional>) -> Result<(),ErrorIdentifier>{match transactional {Some(mut transactional) => {// Use block_on to run the future and get the resultlet commit_result = block_on(async{
transactional.commit_transaction().await});match commit_result {Ok(_) => {}Err(e) => {returnErr(ErrorIdentifier{code:ErrorGlobal::Repository,message: e.to_string(),hint:"error_transactional".to_string(),details:None,})}}}None => {}}Ok(())}
I am using future on my whole project
The text was updated successfully, but these errors were encountered:
but when I have loop case which mutable the transactional, and then got error from db ( specially validation, I accidentally made it error to see the bug ) it was stuck / hang, I tried log in Err but it was not received on there
Are you able to determine on which line specifically your code is hanging? It's difficult to know what exactly is causing the problem without knowing exactly where it's coming from.
is that any way to handle auto abort transactional without call abort_transaction() ?
If a session with an active transaction goes out of scope, the transaction will be aborted automatically in the Drop implementation for ClientSession. That said, I recommend calling abort_transaction specifically if you know that you want to abort your transaction, because running asynchronous operations in Drop implementations can sometimes cause issues.
There has not been any recent activity on this ticket, so we are marking it as stale. If we do not hear anything further from you, this issue will be automatically closed in one week.
There has not been any recent activity on this ticket, so we are closing it. Thanks for reaching out and please feel free to file a new issue if you have further questions.
Versions/Environment
rustup 1.27.1 (2024-04-24)
OS X - Sonoma 14.4.1
registry+https://github.com/rust-lang/crates.io-index#[email protected]
andregistry+https://github.com/rust-lang/crates.io-index#[email protected]
Mongo Atlas 7.0.11 ( free tier )
sharded cluster
,Describe the bug
I have a repository trait that use on services via transaction, here is my code
when I was using the function above on non looping case, it was works well, but when I have loop case which mutable the transactional, and then got error from db ( specially validation, I accidentally made it error to see the bug ) it was stuck / hang, I tried log in
Err
but it was not received on thereis that any way to handle auto abort transactional without call abort_transaction() ?
is that something wrong with code because I did wrong way to use that transaction ??
here how I use those function
at the end function above, I commit the transition like this IF not error ( but in fact the code not arrive on here yet , because the code above was bug )
I am using
future
on my whole projectThe text was updated successfully, but these errors were encountered: