feat(pj_plugins): expose DataSourceHandle::libraryOwner() for lazy-payload DSO lifetime#116
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
libraryOwner()accessor toDataSourceHandlereturning the handle's existingshared_ptr<void>DSO keepalive token, plus doc updates.Why
A lazy
ObjectStorepayload anchor carries the producing plugin'sreleasefn (code compiled into the plugin.so) and can outlive theDataSourceHandlethat 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.sois notdlclosed while plugin code can still run. This is the SDK side of an app-close use-after-free fix observed with lazyPJ.VideoFramepayloads.The token already existed on the handle (
library_owner_); this only exposes it.Scope / compatibility
pj_plugins/include/pj_plugins/host/) — never included by plugins.pj_baseabidiff baseline change → no version bump (invisible to the plugin-compatibility contract).Docs
pj_plugins/CLAUDE.md— the "handles keep the DSO mapped" gotcha now nameslibraryOwner()+ 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