Repository navigation
Conversation
…emory limit The extension counted `aws.lambda.enhanced.out_of_memory` for every invocation whose PlatformReport had max_memory_used_mb == memory_size_mb, including successful ones. A JVM heap can fill the memory size and keep working, so Java functions reported OOMs on invocations that succeeded (#1536). Count the memory-equality case only when the invocation status is not Success. The log-line and Runtime.OutOfMemory paths are unchanged. Co-Authored-By: Claude Opus 5.5 <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.
Problem
Java functions report the out-of-memory (OOM) metric,
aws.lambda.enhanced.out_of_memory, for invocations that succeed (#1536). The reporter sees about 1000 times more OOM metrics than errors after an upgrade from v97 to v99.From v98 (#1241), the extension counts an OOM when a platform report has
Max Memory Usedequal toMemory Size. This applies to every runtime. A JVM heap can grow to fill the memory size and keep working. So a warm Java function can meet this condition on every invocation without running out of memory.This PR
The extension counts the memory-equality case only when the invocation status is not
Success. This PR does not change the two other OOM checks: the runtime-specific OOM log line, and theRuntime.OutOfMemoryerror type.The OOM case that #1241 added the check for still counts. In the Node repro for #1237, the OOMs that only the equality check caught had status
timeout. The other OOM cases had statuserror.Testing
Unit tests
Steps
cargo test --libcargo fmt --checkcargo clippy --workspace --all-targets --features defaultResult
All 765 tests pass, including a new test: a successful invocation at the memory limit sends no OOM metric. The existing equality test now uses status
Error. Format and Clippy are clean.Java function in Lambda
Steps
Max Memory UsedandStatusfrom each platform report.aws.lambda.enhanced.out_of_memoryfor the function in Datadog.Result
Max Memory Used/Memory SizeThe same function with v97 sent 0 OOM metrics. The before and after runs used different architectures. "After" ran inside the existing OOM integration suite, and the other OOM cases (Node, Python, Java, .NET, Go) each sent exactly 1 OOM metric. The Ruby case sent 0 in that run because the kernel killed the extension (
Extension.Crash). It passed in the next run.This PR adds no integration test. A successful invocation reports exactly 512 of 512 MB only in a narrow range of memory use. The same setup gave 512 MB in one run and 511 MB in the next. A test for this would be flaky, or it would pass without reaching the condition.
Impact
On arm64 functions with 512 MB, invocations that the kernel killed for memory reported
Max Memory Usedof 510 to 511 MB, not 512. So the memory-equality check does not catch those OOMs. Their reports had the error typeRuntime.OutOfMemory, which the extension also checks. I measured this only at 512 MB in us-east-1.🤖 Generated with Claude Code