Skip to content

close() / closeSync() causes SIGSEGV or process hang after query execution on file-based databases #8

@omardoescode

Description

@omardoescode

Description

Calling conn.closeSync() / db.closeSync() (or the async close() variants) on a file-based database after executing queries causes:

  • Node.js: SIGSEGV (segfault / core dump) on process exit
  • Electron: process hangs indefinitely, never exits

In-memory databases (:memory:) are not affected.

Environment

  • @ladybugdb/core 0.15.3
  • Node.js v22.22.2 (also reproduced on v24.14.0 via Electron 41.2.0)
  • Linux x64 (Arch Linux, kernel 6.19.11)

Reproduction

const lbug = require('@ladybugdb/core');

  (async () => {
    const db = new lbug.Database('./test.lbdb');
    const conn = new lbug.Connection(db);
    await conn.query('CREATE NODE TABLE IF NOT EXISTS T(id STRING PRIMARY KEY)');
    const id = 'test-' + Date.now();
    await conn.query(`CREATE (:T {id: '${id}'})`);
    await conn.query('MATCH (t:T) RETURN t.id');
    conn.closeSync();
    db.closeSync();
    console.log('Done — process should exit');
  })();
$ node test.js
Done — process should exit
[1]    986506 segmentation fault (core dumped)  node test.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions