You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sqlite: segmentation fault using SQLTagStore if there's no reference to the underlying database #60448
Linux localhost 6.17.4-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 19 18:47:49 UTC 2025 x86_64 GNU/Linux
Subsystem
sqlite
What steps will reproduce the bug?
import{DatabaseSync}from"node:sqlite";// Creating a SQLTagStore without holding a reference to the DatabaseSync:constsql=newDatabaseSync(":memory:").createTagStore();// Substituting line 3 with these two fixes the segfault:// const db = new DatabaseSync(":memory:");// const sql = db.createTagStore();sql.db.exec("CREATE TABLE TEST (DATA NUMBER)");// Simulating meaningful work/likely triggering garbage collection...for(constxofnewArray(100_000).fill(0)){x+x;}console.log("About to run insert...");sql.run`INSERT INTO TEST (DATA) VALUES (1)`;// Code will segfault and never run the following logconsole.log("didn't segfault!");
How often does it reproduce? Is there a required condition?
Running the snippet will always, unconditionally, cause a SIGSEGV on my machine.
What is the expected behavior? Why is that the expected behavior?
Ideally, the program inserts the data and doesn't crash, outputting:
About to run insert...
didn't segfault!
If the new DatabaseSync().createTagStore() usecase is unsupported, then I'd expect a user-friendly error letting me know that it's my responsibility to keep the DatabaseSync in scope, or some other way of preventing this unsupported pattern.
What do you see instead?
fish: Job 1, 'node index.js' terminated by signal SIGSEGV (Address boundary error)
Additional information
The reason I tried keeping only a SQLTagStore is because the tag store has a db field - I liked the idea of only holding a tag store and using sql.db when needed, instead of holding both a DatabaseSync and a SQLTagStore.
Activity