Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Crashes in Offline Mode When Server is Stopped #293

Open
patrykwegrzyn opened this issue Jan 29, 2025 · 1 comment
Open

Client Crashes in Offline Mode When Server is Stopped #293

patrykwegrzyn opened this issue Jan 29, 2025 · 1 comment

Comments

@patrykwegrzyn
Copy link

patrykwegrzyn commented Jan 29, 2025

Description

When running the client in offline mode, the application crashes when the server is stopped.
My understanding is the offline mode should allow local database operations without requiring an active connection to the sync server.

Steps to Reproduce

import { createClient } from "@libsql/client";

async function example() {
  const config = {
    url: process.env.URL ?? "file:local.db",
    syncUrl: "http://localhost:8084", 
    offline: true,
  };
  const db = createClient(config);
  await db.execute(
    "CREATE TABLE IF NOT EXISTS guest_book_entries (comment TEXT)"
  );
}

example();

Stop the sync server while client is running.

Expected Behaviour

The client should operate in offline mode without a crash.

Actual Behaviour

The application crashes with the following error:

2025-01-29T21:14:30.093225Z ERROR tower_http::trace::on_failure: response failed classification=Error: error trying to connect: tcp connect error: Connection refused (os error 111) latency=1 ms
/home/xxx/libsqltest/node_modules/@libsql/client/node_modules/libsql/index.js:116
      const stmt = databasePrepareSync.call(this.db, sql);
                                       ^

Error: WriteDelegation(status: Unavailable, message: "error trying to connect: tcp connect error: Connection refused (os error 111)", details: [], metadata: MetadataMap { headers: {} }

Caused by:
    0: error trying to connect: tcp connect error: Connection refused (os error 111)
    1: tcp connect error: Connection refused (os error 111)
    2: Connection refused (os error 111))

Environment

  • @libsql/client version: 0.14.0
  • Node.js version: 22.4.0
  • OS: Linux
@khuezy
Copy link

khuezy commented Jan 29, 2025

The libsql panic also takes down the node server too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants