tursodatabase / tursodatabase/libsql

`db.connect` panics when used in a single threaded environment

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

Nobody has claimed this yet.

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

Description

Consider this code (introduced via this PR: https://github.com/tursodatabase/libsql/pull/2029)

https://github.com/tursodatabase/libsql/blob/10f5dd836f93a673ca95d5134dd06110dcb2c9b2/libsql/src/database.rs#L685-L695

If libsql library is used in a single threaded environment, then it fails with following error:

can call blocking only when running on the multi-threaded runtime

This is happening due to incorrect use of block_in_place which should be used only in multiple threaded environments.

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 reading the linked section of libsql/src/database.rs around lines 685-695 and reproduce db.connect in a single-threaded environment. The issue is done when that use no longer panics with the multi-threaded-runtime error, while the existing multi-threaded environment continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.