tursodatabase / tursodatabase/libsql

Thread safety assertion woes

Open
#2,096 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We had a pull request to relax the thread safety checks in https://github.com/tursodatabase/libsql/pull/1887. However we ended up opting for for https://github.com/tursodatabase/libsql/pull/1891, but it requires clients to rely on something we tag as unsafe. Let's look into fixing thread safety checks in a safe way.

The issue manifests, for example, with some Tauri apps:

Failed to initialize embedded replica: ❌ spawn_blocking task failed: task 48 panicked with message "assertion `left == right` failed: libsql was configured with an incorrect threading configuration and\n                    the api is not safe to use. Please check that no multi-thread options have\n                    been set. If nothing was configured then please open an issue at:\n                    https://github.com/libsql/libsql\n  left: 21\n right: 0"

Full Discord thread here: https://discord.com/channels/933071162680958986/1379937960547586098

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 by reviewing pull requests 1887 and 1891 to understand the threading-check alternatives, then read the linked Discord discussion for the Tauri failure context. Reproduce or inspect the embedded replica initialization path and define a safe resolution for the assertion without requiring clients to rely on an unsafe configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.