ApiError: Unexpected error: No transaction to rollback

Open
#2,485 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
database

Research direction

Start by tracing the rollback flow through error.rs, db_impl.rs, and transaction.rs, especially the transaction creation and final rollback paths shown in the Sentry trace. Check the existing rollback implementations and their error handling. Done means a failed transaction creation no longer produces an unexpected "No transaction to rollback" API error, with behavior covered by the relevant tests.

Written by the indexing model from the issue text.

Description

Sentry Issue: SYNCSTORAGE-RS-HE

  File "error.rs", line 95, in syncstorage_spanner::error::DbError::from
  File "error.rs", line 46, in syncstorage_spanner::error::DbError::internal
  File "db_impl.rs", line 190, in syncstorage_spanner::db::db_impl::<T>::rollback::{{closure}}
  File "transaction.rs", line 67, in syncserver::web::transaction::DbTransactionPool::transaction_internal::{{closure}}
  File "transaction.rs", line 156, in syncserver::web::transaction::DbTransactionPool::transaction_http::{{closure}}
...
(86 additional frame(s) were not displayed){code}

This occurs when there was an error creating a transaction, so the final `rollback` has nothing to do. We should have our `rollback` impls either return a specific error in this case that we can safely ignore (such as [e.g. diesel does|https://docs.rs/diesel/latest/diesel/result/enum.Error.html#variant.NotInTransaction]) or treat the rollback as a noop (which e.g. [sqlalchemy does|https://docs.sqlalchemy.org/en/21/orm/session_api.html#sqlalchemy.orm.Session.rollback]).

Issue is synchronized with a [GitHub Issue|https://github.com/mozilla-services/syncstorage-rs/issues/2485]

┆Issue is synchronized with this Jira Task

Dominant language
Rust
Stars
1.8k
Forks
86
Avg merge
2d 17h
Merged PRs (30d)
21

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla-services/syncstorage-rs

All issues in mozilla-services/syncstorage-rs

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.