Skip to content

close fn can silently leave SQLite connections open #24

Description

@Ramblurr

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions