tursodatabase / tursodatabase/libsql

Migration is invalid related panic

Open
#1,311 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

We have an user report a database returning HTTP 500. The show the following panic:

[info] 2024-04-12T08:18:57.859415Z ERROR libsql_server::error: HTTP API: 500 Internal Server Error, Anyhow(migration error: migration is invalid: it contains transaction items (BEGIN, COMMIT, SAVEPOINT...) which are not allowed. The migration is already run within a transaction
[info] Caused by:
[info] migration is invalid: it contains transaction items (BEGIN, COMMIT, SAVEPOINT...) which are not allowed. The migration is already run within a transaction
[info] Stack backtrace:
[info] 0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
[info] 1: libsql_server::hrana::batch::catch_batch_error
[info] 2: libsql_server::hrana::batch::execute_batch::{{closure}}
[info] 3: libsql_server::hrana::http::handle_pipeline::{{closure}}
[info] 4: libsql_server::hrana::http::Server::handle_request::{{closure}}
[info] 5: <F as axum::handler::Handler<(M,T1,T2,T3,T4),S,B>>::call::{{closure}}
[info] 6: <tower::util::map_response::MapResponseFuture<F,N> as core::future::future::Future>::poll
[info] 7: <axum::routing::route::RouteFuture<B,E> as core::future::future::Future>::poll
[info] 8: <tower::util::map_response::MapResponseFuture<F,N> as core::future::future::Future>::poll
[info] 9: <axum::routing::route::RouteFuture<B,E> as core::future::future::Future>::poll
[info] 10: <tower::util::map_response::MapResponseFuture<F,N> as core::future::future::Future>::poll
[info] 11: <axum::routing::route::RouteFuture<B,E> as core::future::future::Future>::poll
[info] 12: <tower::util::map_response::MapResponseFuture<F,N> as core::future::future::Future>::poll
[info] 13: <axum::routing::route::RouteFuture<B,E> as core::future::future::Future>::poll
[info] 14: <tower::util::map_response::MapResponseFuture<F,N> as core::future::future::Future>::poll
[info] 15: <axum::routing::route::RouteFuture<B,E> as core::future::future::Future>::poll
[info] 16: <libsql_server::h2c::H2c<S,B> as tower_service::Service<http::request::Request<hyper::body::body::Body>>>::call::{{closure}}
[info] 17: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_inner
[info] 18: <hyper::server::server::new_svc::NewSvcTask<I,N,S,E,W> as core::future::future::Future>::poll
[info] 19: tokio::runtime::task::raw::poll
[info] 20: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
[info] 21: tokio::runtime::scheduler::multi_thread::worker::run
[info] 22: tokio::runtime::task::raw::poll
[info] 23: std::sys_common::backtrace::__rust_begin_short_backtrace
[info] 24: core::ops::function::FnOnce::call_once{{vtable.shim}}
[info] 25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
[info] at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
[info] 26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
[info] at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
[info] 27: std::sys::unix::thread::Thread::new::thread_start
[info] at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/thread.rs:108:17
[info] 28: start_thread
[info] 29: clone)
[info] 2024-04-12T08:23:25.289637Z ERROR libsql_server::hrana::http: hrana server: migration error: migration is invalid: it contains transaction items (BEGIN, COMMIT, SAVEPOINT...) which are not allowed. The migration is already run within a transaction

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.

Research direction

Start with the reported HTTP API failure and the libsql_server::hrana::batch::catch_batch_error entry point, then reproduce the migration error involving BEGIN, COMMIT, or SAVEPOINT statements. Done requires identifying the cause of the 500 response and confirming the affected migration path behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.