Skip to content

feat(pj_plugins): expose DataSourceHandle::libraryOwner() for lazy-payload DSO lifetime#116

Merged
facontidavide merged 2 commits into
mainfrom
feat/datasource-handle-library-owner
Jun 9, 2026
Merged

feat(pj_plugins): expose DataSourceHandle::libraryOwner() for lazy-payload DSO lifetime#116
facontidavide merged 2 commits into
mainfrom
feat/datasource-handle-library-owner

Conversation

@facontidavide

Copy link
Copy Markdown
Contributor

What

Adds a libraryOwner() accessor to DataSourceHandle returning the handle's existing shared_ptr<void> DSO keepalive token, plus doc updates.

Why

A lazy ObjectStore payload anchor carries the producing plugin's release fn (code compiled into the plugin .so) and can outlive the DataSourceHandle that loaded the plugin — e.g. a cached entry surviving a mid-session catalog reload (marketplace install/uninstall) or app close. The host needs to capture the handle's DSO token into each such anchor so the .so is not dlclosed while plugin code can still run. This is the SDK side of an app-close use-after-free fix observed with lazy PJ.VideoFrame payloads.

The token already existed on the handle (library_owner_); this only exposes it.

Scope / compatibility

  • Host-side header only (pj_plugins/include/pj_plugins/host/) — never included by plugins.
  • No plugin ABI change; no pj_base abidiff baseline change → no version bump (invisible to the plugin-compatibility contract).

Docs

  • pj_plugins/CLAUDE.md — the "handles keep the DSO mapped" gotcha now names libraryOwner() + the lazy-anchor case.
  • pj_plugins/docs/ARCHITECTURE.md §6 — the RAII-handle DSO-retention contract now covers the lazy-anchor extension.

🤖 Generated with Claude Code

facontidavide and others added 2 commits June 8, 2026 19:21
…yload DSO lifetime

A lazy ObjectStore payload anchor carries the producing plugin's release fn
(plugin .so code) and can outlive the DataSourceHandle that loaded the plugin —
a cached entry surviving a mid-session catalog reload or app close. The host
captures the handle's DSO keepalive token into each such anchor so the .so is
not dlclosed while plugin code can still run. Expose the existing library_owner_
token via a libraryOwner() accessor for that purpose.

Host-side header only (pj_plugins/host/), invisible to plugins — no plugin ABI
or pj_base baseline change, so no version bump.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@facontidavide facontidavide merged commit 5ee9eee into main Jun 9, 2026
4 checks passed
@facontidavide facontidavide deleted the feat/datasource-handle-library-owner branch June 9, 2026 08:28
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.

1 participant