syncstorage-rs icon indicating copy to clipboard operation
syncstorage-rs copied to clipboard

range end index 4 out of range for slice of length 0 with mariadb

Open y-martin opened this issue 2 months ago • 3 comments

Hello

Upgrade from 0.20, I can see error on my logs like: firefox-syncstorage[821033]: thread 'tokio-runtime-worker' panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.2.12/src/mysql/value.rs:69:76: firefox-syncstorage[821033]: range end index 4 out of range for slice of length 0

I wonder if it's related to diesel 2.x migration, https://github.com/diesel-rs/diesel/issues/4699 and the fact I running mariadb.

Regards

┆Issue is synchronized with this Jira Task

y-martin avatar Oct 19 '25 09:10 y-martin

Ok, on 0.20 (diesel 1.4), I also see this issue triggered my firefox mobile v144.0 sync:

Oct 19 16:16:46.146 INFO {"ua.browser.ver":"144.0","uri.path":"/1.5/4/info/collections","ua":"144.0","ua.name":"Firefox","uri.method":"GET","ua.os.family":"Other","ua.os.ver":"12","ua.browser.family":"Firefox"}
Oct 19 16:16:46.299 DEBG Query ran in 0.3 ms: SELECT `user_collections`.`last_modified` FROM `user_collections` WHERE `user_collections`.`userid` = ? AND `user_collections`.`collection` = ? LIMIT ? LOCK IN SHARE MODE -- binds: [4, 1, 1]
Oct 19 16:16:46.300 DEBG Query ran in 0.3 ms: SELECT `bso`.`id`, `bso`.`modified`, `bso`.`payload`, `bso`.`sortindex`, `bso`.`ttl` FROM `bso` WHERE `bso`.`userid` = ? AND `bso`.`collection` = ? AND `bso`.`ttl` > ? LIMIT ? -- binds: [4, 1, 1760890606290, 10001]
Oct 19 16:16:46.300 INFO {"ua":"144.0","uri.method":"GET","ua.name":"Firefox","ua.browser.ver":"144.0","ua.os.ver":"12","uri.path":"/1.5/4/storage/clients?full=1","ua.browser.family":"Firefox","ua.os.family":"Other"}
Oct 19 16:16:46.333 DEBG Query ran in 0.2 ms: SELECT `user_collections`.`last_modified` FROM `user_collections` WHERE `user_collections`.`userid` = ? AND `user_collections`.`collection` = ? LIMIT ? LOCK IN SHARE MODE -- binds: [4, 10, 1]
thread 'tokio-runtime-worker' panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/type_impls/integers.rs:46:9:
Received fewer than 4 bytes decoding i32. Was a SmallInteger expression accidentally identified as Integer?
stack backtrace:
   0:     0x5c7465696d02 - std::backtrace_rs::backtrace::libunwind::trace::h2d45396358f41939
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1:     0x5c7465696d02 - std::backtrace_rs::backtrace::trace_unsynchronized::hffcefc0b67f1d6e2
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2:     0x5c7465696d02 - std::sys::backtrace::_print_fmt::hd72f71d23b436b92
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/backtrace.rs:66:9
   3:     0x5c7465696d02 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hdcfcb6d4c8489523
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/backtrace.rs:39:26
   4:     0x5c74656c04c3 - core::fmt::rt::Argument::fmt::h2c56b3114963061a
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/fmt/rt.rs:173:76
   5:     0x5c74656c04c3 - core::fmt::write::h8a494366950f23bb
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/fmt/mod.rs:1468:25
   6:     0x5c7465692c93 - std::io::default_write_fmt::ha27fbccbc65eb6fa
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/io/mod.rs:639:11
   7:     0x5c7465692c93 - std::io::Write::write_fmt::h6556609fca33d0b1
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/io/mod.rs:1954:13
   8:     0x5c7465696b52 - std::sys::backtrace::BacktraceLock::print::hb2a626a81e06b2dc
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/backtrace.rs:42:9
   9:     0x5c7465697ec3 - std::panicking::default_hook::{{closure}}::h4f78485264f12d10
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:300:27
  10:     0x5c7465697ca5 - std::panicking::default_hook::h2c66fc99e962531d
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:327:9
  11:     0x5c74656988d5 - std::panicking::rust_panic_with_hook::h33ac55f64bbd807d
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:833:13
  12:     0x5c74656987ac - std::panicking::begin_panic::{{closure}}::h9f4a5adc680e21fa
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:770:9
  13:     0x5c74656971f9 - std::sys::backtrace::__rust_end_short_backtrace::hb5f90b203e68dc50
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/backtrace.rs:174:18
  14:     0x5c74656986c2 - std::panicking::begin_panic::h5128ce11a6f84a23
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:769:5
  15:     0x5c7464c4cfd3 - diesel::type_impls::integers::<impl diesel::deserialize::FromSql<diesel::sql_types::Integer,DB> for i32>::from_sql::hcabe751c4ff14b69
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/type_impls/integers.rs:46:9
  16:     0x5c7464ae05d4 - diesel::type_impls::primitives::foreign_impls::_impl_from_sql_row_for_i32proxy::<impl diesel::deserialize::FromSqlRow<__ST,__DB> for i32>::build_from_row::h038ccaca5ddafe58
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/type_impls/primitives.rs:28:14
  17:     0x5c7464bd4675 - diesel::type_impls::option::<impl diesel::deserialize::FromSqlRow<diesel::sql_types::Nullable<ST>,DB> for core::option::Option<T>>::build_from_row::heb829bcd5145c24d
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/type_impls/option.rs:110:13
  18:     0x5c7464b37788 - diesel::type_impls::tuples::<impl diesel::deserialize::FromSqlRow<(SA,SB,SC,SD,SE),__DB> for (A,B,C,D,E)>::build_from_row::h86b9d9820029e7f0
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/type_impls/tuples.rs:57:27
  19:     0x5c7464b33ff2 - <diesel::mysql::connection::MysqlConnection as diesel::connection::Connection>::query_by_index::{{closure}}::h1cf0f6e0ff973e2e
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/mysql/connection/mod.rs:78:13
  20:     0x5c7464b5281b - diesel::mysql::connection::stmt::iterator::StatementIterator::map::hd1c2b2e59665bfd2
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/mysql/connection/stmt/iterator.rs:34:26
  21:     0x5c7464b32758 - <diesel::mysql::connection::MysqlConnection as diesel::connection::Connection>::query_by_index::h5523873182339fb9
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/mysql/connection/mod.rs:77:17
  22:     0x5c7464a2868d - diesel::r2d2::<impl diesel::connection::Connection for r2d2::PooledConnection<diesel::r2d2::ConnectionManager<C>>>::query_by_index::hb99c6af8b3796cd5
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/r2d2.rs:134:19
  23:     0x5c7464b5c19c - <diesel_logger::LoggingConnection<C> as diesel::connection::Connection>::query_by_index::hea45fb80283693e4
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel_logger-0.1.1/src/lib.rs:78:29
  24:     0x5c7464a09542 - <T as diesel::query_dsl::load_dsl::LoadQuery<Conn,U>>::internal_load::h349fdd5e16245f49
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/query_dsl/load_dsl.rs:30:14
  25:     0x5c7464a09257 - diesel::query_dsl::RunQueryDsl::load::h27f6095b9fbb4b9c
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-1.4.8/src/query_dsl/mod.rs:1240:14
  26:     0x5c74649e70c2 - syncstorage_mysql::models::MysqlDb::get_bsos_sync::h5f6f723bf1668714
                               at /root/app/syncstorage-mysql/src/models.rs:541:30
  27:     0x5c7464ae86df - <syncstorage_mysql::models::MysqlDb as syncstorage_db_common::Db>::get_bsos::{{closure}}::h9eac804dd6429502
                               at /root/app/syncserver-db-common/src/lib.rs:50:39
  28:     0x5c7464b4d380 - syncserver_common::BlockingThreadpool::spawn::{{closure}}::{{closure}}::hd3cf77ce767f45a3
                               at /root/app/syncserver-common/src/lib.rs:148:13
  29:     0x5c7464a38913 - <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll::hc4bb95fdecd265ac
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/blocking/task.rs:42:21
  30:     0x5c7464a8d2c5 - tokio::runtime::task::core::Core<T,S>::poll::{{closure}}::h98244142a84182a5
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/core.rs:365:24
  31:     0x5c7464a85c3b - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h322b8083377aff6a
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/loom/std/unsafe_cell.rs:16:9
  32:     0x5c7464a85c3b - tokio::runtime::task::core::Core<T,S>::poll::h45303d677fa63caa
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/core.rs:354:30
  33:     0x5c7464ab9a98 - tokio::runtime::task::harness::poll_future::{{closure}}::h06906881d9224d2b
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/harness.rs:535:30
  34:     0x5c7464b9f39b - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h019a35715a447c38
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panic/unwind_safe.rs:272:9
  35:     0x5c7464b95e58 - std::panicking::catch_unwind::do_call::hee920d53bae61af8
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:589:40
  36:     0x5c7464b907eb - __rust_try
  37:     0x5c7464b8ad98 - std::panicking::catch_unwind::hfa6644175d2695fd
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:552:19
  38:     0x5c7464b8ad98 - std::panic::catch_unwind::h8d31aad6c679dc36
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panic.rs:359:14
  39:     0x5c7464ab75b2 - tokio::runtime::task::harness::poll_future::he22ea5cd518f65aa
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/harness.rs:523:18
  40:     0x5c7464ac2778 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::ha4092956ec687555
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/harness.rs:210:27
  41:     0x5c7464acf367 - tokio::runtime::task::harness::Harness<T,S>::poll::h84d66c55ff68f7ea
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/harness.rs:155:20
  42:     0x5c7464aa212d - tokio::runtime::task::raw::poll::hb44724601f76b076
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/raw.rs:325:13
  43:     0x5c7465246547 - tokio::runtime::task::raw::RawTask::poll::h5ef34f9707e7e709
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/raw.rs:255:18
  44:     0x5c746524c5e7 - tokio::runtime::task::UnownedTask<S>::run::h8afa32167af9e2bc
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/task/mod.rs:546:13
  45:     0x5c7465203547 - tokio::runtime::blocking::pool::Task::run::h1bd8482c47ee6e68
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/blocking/pool.rs:161:19
  46:     0x5c7465204ef0 - tokio::runtime::blocking::pool::Inner::run::h6ca8f66fb6b34f0e
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/blocking/pool.rs:516:22
  47:     0x5c7465204c0c - tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}::h7c31739a01197f04
                               at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.47.1/src/runtime/blocking/pool.rs:474:47
  48:     0x5c7465215f86 - std::sys::backtrace::__rust_begin_short_backtrace::h9984431e1944e28b
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/backtrace.rs:158:18
  49:     0x5c74652077c2 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::hf90b384b9e30a002
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/thread/mod.rs:559:17
  50:     0x5c746522d5e1 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h4c95212b3a195f0b
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panic/unwind_safe.rs:272:9
  51:     0x5c74651f9e5c - std::panicking::catch_unwind::do_call::h2b4f013c444ad5f9
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:589:40
  52:     0x5c746520a87b - __rust_try
  53:     0x5c74652073b8 - std::panicking::catch_unwind::h957e6c0bdaf14f07
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:552:19
  54:     0x5c74652073b8 - std::panic::catch_unwind::h52474c1e12ee82d4
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panic.rs:359:14
  55:     0x5c74652073b8 - std::thread::Builder::spawn_unchecked_::{{closure}}::hef263fc90082d595
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/thread/mod.rs:557:30
  56:     0x5c74651fa68f - core::ops::function::FnOnce::call_once{{vtable.shim}}::hb198d5d67332a52e
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/ops/function.rs:253:5
  57:     0x5c746569ba6f - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5924238c754de3b8
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/alloc/src/boxed.rs:1971:9
  58:     0x5c746569ba6f - std::sys::pal::unix::thread::Thread::new::thread_start::hb6e99e73da4d28f8
                               at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/sys/pal/unix/thread.rs:107:17
  59:     0x7d870fe3c1f5 - <unknown>
  60:     0x7d870febbb40 - __clone
  61:                0x0 - <unknown>
Oct 19 16:16:46.453 DEBG Reporting error to Sentry (response error): Unexpected error: Blocking threadpool operation canceled
Oct 19 16:16:46.468 INFO {"ua.name":"Firefox","ua.os.ver":"12","uri.path":"/1.5/4/storage/passwords?full=1&newer=1760888601.72","ua.browser.ver":"144.0","uri.method":"GET","ua":"144.0","ua.os.family":"Other","ua.browser.family":"Firefox"}
``

y-martin avatar Oct 19 '25 16:10 y-martin

Hey. I found out I have the same problem yesterday too. Additional to your logs, in the firefox app I saw in about:sync-log that my history was not synchronizing (and indeed confirmed it does not with another device). I've build docker image with commits up to https://github.com/mozilla-services/syncstorage-rs/commit/0dd2c8179d44a7b8db2036f373f320602715c28f and the problem disappeared, so until a new release is out, that's what you probably would need to do.

EDIT: Forgot to mention that I'm using mysql 8.x not mariadb, so your milage may vary; there is at least this which applies to you as well (since you are the owner of that topic too).

retmas-gh avatar Oct 19 '25 19:10 retmas-gh

Hello @retmas-gh

Thanks, I build up to 0dd2c81 and firefox v144 sync works again. I already picked the patch that revert the commit that breaks mariadb support.

Regards

y-martin avatar Oct 20 '25 06:10 y-martin