What happens?
Noticed a segfault when trying to view tables in an attached .sqlite file in the DuckDB UI, found a minimal reproducer using the duckdb CLI only
Appears to be a multithreading issue (does not happen with threads=1)
Confirmed on latest main duckdb-sqlite (fb7cf51c)
To Reproduce
Note PRAGMA threads=1; avoids all of these
Setup
sqlite3 /tmp/repro_metadata_min.sqlite <<'SQL'
BEGIN;
CREATE TABLE t1(id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE t2(id INTEGER PRIMARY KEY, value TEXT);
COMMIT;
SQL
Repros
ATTACH '/tmp/repro_metadata_min.sqlite' AS cat (TYPE sqlite);
SELECT 1
FROM duckdb_columns(), duckdb_tables(), duckdb_constraints()
LIMIT 1;
often segfaults, sometimes also see
- Not implemented Error: Unimplemented constraint for duckdb_constraints
- Out of Memory Error: Allocation failure
- INTERNAL Error: Information loss on integer cast ...
ATTACH '/tmp/repro_metadata_min.sqlite' AS cat (TYPE sqlite);
SELECT t.table_oid
FROM duckdb_columns() columns
LEFT JOIN duckdb_tables() t USING (table_oid)
LEFT JOIN duckdb_constraints() c USING (table_oid)
WHERE NOT columns.internal
LIMIT 1;
often segfaults, sometimes also see
- Not implemented Error: Unimplemented constraint for duckdb_constraints.
Also tried:
- duckdb_columns(), duckdb_tables() alone: no crash.
- duckdb_columns(), duckdb_constraints() alone: no crash.
- duckdb_columns() LEFT JOIN duckdb_constraints(): no crash.
- duckdb_tables(), duckdb_constraints() alone: no crash.
The crashes appeared once duckdb_constraints() was involved together with both of the other metadata table functions in the same statement.
OS:
Ubuntu 24.04.3 LTS (WSL2 x64); Ubuntu 25.04 (x64)
SQLite Version:
3.45.1; 3.46.1
DuckDB Version:
1.5.0
DuckDB Client:
CLI
Full Name:
Aaron Miller
Affiliation:
Nomic AI
Have you tried this on the latest main branch?
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
What happens?
Noticed a segfault when trying to view tables in an attached .sqlite file in the DuckDB UI, found a minimal reproducer using the duckdb CLI only
Appears to be a multithreading issue (does not happen with threads=1)
Confirmed on latest
mainduckdb-sqlite(fb7cf51c)To Reproduce
Note
PRAGMA threads=1;avoids all of theseSetup
Repros
often segfaults, sometimes also see
often segfaults, sometimes also see
Also tried:
The crashes appeared once duckdb_constraints() was involved together with both of the other metadata table functions in the same statement.
OS:
Ubuntu 24.04.3 LTS (WSL2 x64); Ubuntu 25.04 (x64)
SQLite Version:
3.45.1; 3.46.1
DuckDB Version:
1.5.0
DuckDB Client:
CLI
Full Name:
Aaron Miller
Affiliation:
Nomic AI
Have you tried this on the latest
mainbranch?Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?