tursodatabase / tursodatabase/libsql

react native / iOS incorrect threading configuration

Open
#1,904 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Building on iOS is crashing (when using different sqlite implementations?)

https://github.com/OP-Engineering/op-sqlite (11.2.5).

https://github.com/OP-Engineering/op-sqlite/issues/214
https://github.com/expo/expo/issues/33644

Environment

  • Platform: iOS
  • OS version: Xcode 16.2, iOS 18.2
  • Device manufacturer / model: mbp m4 / Apple iPhone 15
  • op-sqlite: 11.2.5

Steps to Reproduce

  1. install @op-engineering/op-sqlite (with libsql: true) and i.e. https://github.com/transistorsoft/react-native-background-geolocation

Context

Trying to run the application in iOS (physical device)

Debug logs

Logs
thread '<unnamed>' panicked at libsql/src/local/database.rs:239:17:
assertion `left == right` failed: libsql was configured with an incorrect threading configuration and
                    the api is not safe to use. Please check that no multi-thread options have
                    been set. If nothing was configured then please open an issue at:
                    https://github.com/libsql/libsql
  left: 21
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at library/core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
   0:        0x104e9d520 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6e07ac9cbc84bbf7
   1:        0x104edd160 - core::fmt::write::he4e08ea2421faad4
   2:        0x104e93388 - std::io::Write::write_fmt::h8e35f44829a6d492
   3:        0x104e9fadc - std::panicking::default_hook::{{closure}}::h5423069eaa907c60
   4:        0x104e9f6e8 - std::panicking::default_hook::ha5bc641a0ba9a664
   5:        0x104ea0784 - std::panicking::rust_panic_with_hook::hff8ab7378efed505
   6:        0x104e9fff0 - std::panicking::begin_panic_handler::{{closure}}::h7f4f159596a77c8b
   7:        0x104e9d9ac - std::sys::backtrace::__rust_end_short_backtrace::hd94c1ab8ebbb033f
   8:        0x104e9fce0 - _rust_begin_unwind
   9:        0x104f9eb70 - core::panicking::panic_nounwind_fmt::h28cf8620a708db9b
  10:        0x104f9ebe8 - core::panicking::panic_nounwind::h23f9ec7786b388ce
  11:        0x104f9ed60 - core::panicking::panic_cannot_unwind::hb9fd807402cdce34
  12:        0x1048c11cc - _libsql_connect
  13:        0x104784aa8 - __ZN8opsqlite20opsqlite_libsql_openERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_
  14:        0x10479fb2c - __ZN8opsqlite12DBHostObjectC2ERN8facebook3jsi7RuntimeERNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENS5_10shared_ptrINS1_5react11CallInvokerEEENSD_INS_10ThreadPoolEEESC_SC_SC_SC_SC_
  15:        0x10479fd10 - __ZN8opsqlite12DBHostObjectC1ERN8facebook3jsi7RuntimeERNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENS5_10shared_ptrINS1_5react11CallInvokerEEENSD_INS_10ThreadPoolEEESC_SC_SC_SC_SC_
  16:        0x10477b064 - __ZNSt3__112construct_atB8de180100IN8opsqlite12DBHostObjectEJRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_10shared_ptrINS3_5react11CallInvokerEEERNSE_INS1_10ThreadPoolEEESD_SD_SD_SD_SD_EPS2_EEPT_SP_DpOT0_
  17:        0x10477af90 - __ZNSt3__114__construct_atB8de180100IN8opsqlite12DBHostObjectEJRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_10shared_ptrINS3_5react11CallInvokerEEERNSE_INS1_10ThreadPoolEEESD_SD_SD_SD_SD_EPS2_EEPT_SP_DpOT0_
  18:        0x10477ad88 - __ZNSt3__116allocator_traitsINS_9allocatorIN8opsqlite12DBHostObjectEEEE9constructB8de180100IS3_JRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS1_IcEEEERKNS_10shared_ptrINS7_5react11CallInvokerEEERNSH_INS2_10ThreadPoolEEESG_SG_SG_SG_SG_EvvEEvRS4_PT_DpOT0_
  19:        0x10477ac5c - __ZNSt3__120__shared_ptr_emplaceIN8opsqlite12DBHostObjectENS_9allocatorIS2_EEEC2B8de180100IJRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS3_IcEEEERKNS_10shared_ptrINS7_5react11CallInvokerEEERNSH_INS1_10ThreadPoolEEESG_SG_SG_SG_SG_ES4_Li0EEES4_DpOT_
  20:        0x10477a8f8 - __ZNSt3__120__shared_ptr_emplaceIN8opsqlite12DBHostObjectENS_9allocatorIS2_EEEC1B8de180100IJRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS3_IcEEEERKNS_10shared_ptrINS7_5react11CallInvokerEEERNSH_INS1_10ThreadPoolEEESG_SG_SG_SG_SG_ES4_Li0EEES4_DpOT_
  21:        0x10477a7ac - __ZNSt3__115allocate_sharedB8de180100IN8opsqlite12DBHostObjectENS_9allocatorIS2_EEJRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS3_IcEEEERKNS_10shared_ptrINS5_5react11CallInvokerEEERNSF_INS1_10ThreadPoolEEESE_SE_SE_SE_SE_EvEENSF_IT_EERKT0_DpOT1_
  22:        0x104779c54 - __ZNSt3__111make_sharedB8de180100IN8opsqlite12DBHostObjectEJRN8facebook3jsi7RuntimeERNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKNS_10shared_ptrINS3_5react11CallInvokerEEERNSE_INS1_10ThreadPoolEEESD_SD_SD_SD_SD_EvEENSE_IT_EEDpOT0_
  23:        0x104779954 - __ZZN8opsqlite7installERN8facebook3jsi7RuntimeERKNSt3__110shared_ptrINS0_5react11CallInvokerEEEPKcSC_SC_ENK3$_0clES3_RKNS1_5ValueEPSF_m
  24:        0x104779568 - __ZNSt3__18__invokeB8de180100IRZN8opsqlite7installERN8facebook3jsi7RuntimeERKNS_10shared_ptrINS2_5react11CallInvokerEEEPKcSD_SD_E3$_0JS5_RKNS3_5ValueEPSH_mEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSK_DpOSL_
  25:        0x1047794f0 - __ZNSt3__128__invoke_void_return_wrapperIN8facebook3jsi5ValueELb0EE6__callB8de180100IJRZN8opsqlite7installERNS2_7RuntimeERKNS_10shared_ptrINS1_5react11CallInvokerEEEPKcSG_SG_E3$_0S8_RKS3_PSJ_mEEES3_DpOT_
  26:        0x1047794a4 - __ZNSt3__110__function12__alloc_funcIZN8opsqlite7installERN8facebook3jsi7RuntimeERKNS_10shared_ptrINS3_5react11CallInvokerEEEPKcSE_SE_E3$_0NS_9allocatorISF_EEFNS4_5ValueES6_RKSI_PSJ_mEEclB8de180100ES6_SK_OSL_Om
  27:        0x1047780d8 - __ZNSt3__110__function6__funcIZN8opsqlite7installERN8facebook3jsi7RuntimeERKNS_10shared_ptrINS3_5react11CallInvokerEEEPKcSE_SE_E3$_0NS_9allocatorISF_EEFNS4_5ValueES6_RKSI_PSJ_mEEclES6_SK_OSL_Om
  28:        0x106031a08 - __ZNKSt3__110__function12__value_funcIFN8facebook3jsi5ValueERNS3_7RuntimeERKS4_PS7_mEEclB8de180100ES6_S8_OS9_Om
  29:        0x10603138c - __ZNKSt3__18functionIFN8facebook3jsi5ValueERNS2_7RuntimeERKS3_PS6_mEEclES5_S7_S8_m
  30:        0x106030a28 - __ZZN8facebook3jsc10JSCRuntime30createFunctionFromHostFunctionERKNS_3jsi10PropNameIDEjNSt3__18functionIFNS2_5ValueERNS2_7RuntimeERKS8_PSB_mEEEEN20HostFunctionMetadata4callEPK15OpaqueJSContextP13OpaqueJSValueSL_mPKPKSK_PSN_
thread caused non-unwinding panic. aborting.

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

Reproduce the iOS crash using @op-engineering/op-sqlite with libsql enabled and the listed background-geolocation package. Start at libsql/src/local/database.rs:239 and trace the _libsql_connect path to identify the threading configuration mismatch. Done means the reported configuration no longer triggers the panic in the stated iOS environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, ios, react-native, rust, sqlite
Domain
databases, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.