Skip to content

Avoid callbacks when opening connection pools - #397

Closed
simolus3 wants to merge 4 commits into
mainfrom
pool-open-refactor
Closed

Avoid callbacks when opening connection pools#397
simolus3 wants to merge 4 commits into
mainfrom
pool-open-refactor

Conversation

@simolus3

@simolus3 simolus3 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

NativeCallable and Pointer.fromFunction are implemented by the Dart VM allocating an FFI stub in a page that is then remapped as executable. This is forbidden on some platforms like GrapheneOS.

To avoid that issue, this splits the pkg_sqlite3_connection_pool_open function into three parts:

  1. pkg_sqlite3_connection_pool_open locks the global mutex of active pools and either returns a handle to the opened pool if it exists already, or indicates that the caller is responsible for initialization.
  2. pkg_sqlite3_connection_pool_initialize takes the role of what used to be a callback, turning an initialized pool into a pool client and unlocking.
  3. pkg_sqlite3_connection_pool_close_uninitialized drops an uninitialized handle without creating a pool, used on exceptions.

Closes #396.

@simolus3

simolus3 commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

Merged in f1cd435.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite3_connection_pool: support opening pools without executable-memory FFI callbacks

1 participant