Skip to content

[k2] implement shared-memory confdata - #1685

Merged
apolyakov merged 46 commits into
masterfrom
apolyakov/k2-confdata-support
Sep 23, 2026
Merged

apolyakov merged 46 commits into
masterfrom
apolyakov/k2-confdata-support

Conversation

@apolyakov

@apolyakov apolyakov commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Implement kphp-confdata.so to synchronize snapshots and incremental updates from confdata-proxy and expose shared-memory data to PHP instances.

Add wildcard lookups, reader leases that preserve snapshots across piece rotation, memory-budget checks, and capacity metrics. Include the component in build and installation targets.

@apolyakov
apolyakov force-pushed the apolyakov/k2-confdata-support branch from edfd3c1 to 554f2e6 Compare September 1, 2026 15:13
@apolyakov
apolyakov force-pushed the apolyakov/k2-confdata-support branch 2 times, most recently from abe987f to abecc07 Compare September 10, 2026 16:15
@apolyakov apolyakov changed the title [k2] add new confdata implementation [k2] implement shared-memory confdata Sep 11, 2026
@apolyakov apolyakov self-assigned this Sep 11, 2026
@apolyakov apolyakov added runtime Feature related to runtime compiler Feature related to compiler k2 Affects compiler or runtime in K2 mode kphp Affects compiler or runtime in default mode (not K2) labels Sep 11, 2026
@apolyakov apolyakov added this to the next milestone Sep 11, 2026
@apolyakov
apolyakov marked this pull request as ready for review September 11, 2026 14:16
Comment thread runtime-light/components/confdata/state/component-state.cpp Outdated
Comment thread runtime-light/stdlib/confdata/confdata-storage.cpp
@apolyakov
apolyakov force-pushed the apolyakov/k2-confdata-support branch from c0dbeb5 to 6d62872 Compare September 15, 2026 14:32
@apolyakov
apolyakov force-pushed the apolyakov/k2-confdata-support branch from 6d62872 to 4f72dcf Compare September 15, 2026 16:02
@apolyakov apolyakov removed the compiler Feature related to compiler label Sep 17, 2026
@apolyakov
apolyakov merged commit 86d059f into master Sep 23, 2026
8 checks passed
@apolyakov
apolyakov deleted the apolyakov/k2-confdata-support branch September 23, 2026 19:11
// The generated shared-memory name and internally acquired sample ID must be valid.
// Failure here is an internal invariant violation, not a recoverable client error.
kphp::log::assertion(lease.has_value());
if (const auto written{co_await connection->get_stream().write_all(std::as_bytes(std::span{std::addressof(*lease), 1}))}; !written) [[unlikely]] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to reorder write_all and register_abort_handler.

If register_abort_handler fails, lease will be destroyed, but write_all has already replied to the KPHP instance that everything is OK. This can leave the instance with access to a shared-memory segment that has already been released. Potential segfault

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

Labels

k2 Affects compiler or runtime in K2 mode kphp Affects compiler or runtime in default mode (not K2) runtime Feature related to runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants