Skip to content

[k2] log error on OOM in pool allocator - #1704

Merged
Shamzik merged 12 commits into
masterfrom
kshamazov/k2/oom_assertion
Oct 19, 2026
Merged

Shamzik merged 12 commits into
masterfrom
kshamazov/k2/oom_assertion

Conversation

@Shamzik

@Shamzik Shamzik commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This PR replaces log::assertion with log::error handling OOM in pool allocator.

It is also rewrites kphp::log::impl::log function so it does not call pool allocator recursivly

@Shamzik Shamzik added runtime Feature related to runtime k2 Affects compiler or runtime in K2 mode labels Oct 8, 2026
@Shamzik Shamzik added this to the next milestone Oct 8, 2026
@Shamzik Shamzik self-assigned this Oct 8, 2026
@Shamzik
Shamzik requested review from LLirikkkk and apolyakov and removed request for LLirikkkk October 9, 2026 10:26
LLirikkkk
LLirikkkk previously approved these changes Oct 10, 2026
Comment thread runtime-light/stdlib/diagnostics/logs.h Outdated
Comment thread runtime-light/allocator/pool-allocator.cpp
Comment thread runtime-light/allocator/pool-allocator.cpp Outdated
Replace OOM assertions in pool_allocator::alloc/calloc/realloc_script_memory
with raise_out_of_memory() that logs MemoryStats (current/peak usage, arena
limit, total allocations, defragmentation calls, free pieces) before exiting,
so OOM failures can be diagnosed from logs.
@Shamzik
Shamzik requested a review from apolyakov October 13, 2026 13:29
Comment thread runtime-light/stdlib/diagnostics/logs.h Outdated
Comment thread runtime-light/stdlib/diagnostics/logs.h Outdated
Comment thread runtime-light/allocator/pool-allocator.cpp Outdated
Comment thread runtime-light/allocator/pool-allocator.cpp
Shamzik and others added 4 commits October 14, 2026 18:00
When a trace is present, contextual tags are capped at
TAGGED_ENTRIES_BUFFER_SIZE - 1 so the trace is never dropped.

Co-Authored-By: Claude Code <noreply@anthropic.com>
raise_out_of_memory() now takes a context string and is reused for the
platform allocation failure in request_extra_memory(), so memory usage
statistics are logged in a single place. The message no longer mentions
the extra-memory request, decoupling it from the allocation strategy.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Shamzik
Shamzik requested a review from denisichh October 15, 2026 09:45

@denisichh denisichh left a comment

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.

LGTM

@Shamzik
Shamzik merged commit f90b8f1 into master Oct 19, 2026
8 of 22 checks passed
@Shamzik
Shamzik deleted the kshamazov/k2/oom_assertion branch October 19, 2026 11:22
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 runtime Feature related to runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants