This gist showcases how DuckDB on nodejs fails silently to handle the same read only database on multiple nodejs processes when running in cluster mode. This behaviour is consistent with the duckdb CLI interface.
Calling (using an in :memory: database)
node cluster.js
outputs the correct result
Forked child
Forked child
Forked child
Forked child
Child done
Child done
Child done
Child done
42
42
42
42
If we use a file database
node cluster.js some-db.duckdb
it'll only run the query once, all other processes in the cluster will fail silently
Forked child
Forked child
Forked child
Forked child
Child done
Child done
Child done
Child done
42
The issue is that there cannot be multiple processes and WRITE mode, so setting duckdb to 'READ_ONLY' will fix this issue.
Gist with update: https://gist.github.com/ataft/42b7cc3d4055cf6b5a62a5f1f57da4b2