The pool's :close function calls sqlite3_close without finalizing cached statements or checking the return code. SQLite can return SQLITE_BUSY, leaving the connection open without reporting an error.
Consider using sqlite3_close_v2, which supports deferred cleanup and is designed for use in garbage-collected languages. Cached statements still need to be finalized so SQLite can release th connection.
ref https://sqlite.org/c3ref/close.html
Could we expose a single (d/close! db) that does something like:
- Finalizes cached statements and closes each distinct pool once.
- Uses
sqlite3_close_v2 and checks return codes.
- Is idempotent
The pool's :close function calls
sqlite3_closewithout finalizing cached statements or checking the return code. SQLite can returnSQLITE_BUSY, leaving the connection open without reporting an error.Consider using
sqlite3_close_v2, which supports deferred cleanup and is designed for use in garbage-collected languages. Cached statements still need to be finalized so SQLite can release th connection.ref https://sqlite.org/c3ref/close.html
Could we expose a single
(d/close! db)that does something like:sqlite3_close_v2and checks return codes.