You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
aws.lambda.enhanced.out_of_memory not emitted when Lambda reaches memory limit but AWS reports as timeout #1237
We are investigating an incident where a Lambda reached its memory limit but our Datadog monitor based on aws.lambda.enhanced.out_of_memory did not trigger.
We tried reproducing a similar case in sandbox Lambda. Enhanced metrics are working generally as expected as we can see that aws.lambda.enhanced.invocations and aws.lambda.enhanced.max_memory_used.
However, the `out_of_memory one remains no-data even when Lambda memory usage reaches the configured limit. ( see screenshot attached below)
Example CloudWatch output we've observed in when reproduced the issue:
INIT_REPORT Init Duration: 180000.45 ms Phase: invoke Status: timeout
REPORT RequestId: 514789fd-5e24-49c5-a41c-24c049a36e2a
Duration: 180000.00 ms
Billed Duration: 180000 ms
Memory Size: 192 MB
Max Memory Used: 192 MB
Status: timeout
We also saw similar tests where memory was very close to the limit:
In these cases, Datadog emitted aws.lambda.enhanced.max_memory_used, but did not emit aws.lambda.enhanced.out_of_memory.
The Datadog extension appears to be running and subscribed to telemetry:
From an operational perspective, this looks like memory exhaustion leading to timeout, but the OOM metric does not emit.
Could you confirm whether this is expected behaviour?
Environment variables used:
changed the title [-]aws.lambda.enhanced.out_of_memory not emitted when Lambda reaches memory limit but AWS reports invocation as timeout[/-][+]aws.lambda.enhanced.out_of_memory not emitted when Lambda reaches memory limit but AWS reports as timeout[/+]on May 22, 2026
OOMs are tricky to capture, and here's how we currently capture OOMs for each runtime:
Node: runtime-specific log message:
JavaScript heap out of memory, or
Runtime exited with error: signal: killed
Java: runtime-specific log message:
java.lang.OutOfMemoryError
.NET: runtime-specific log message:
OutOfMemoryException
Python and Ruby: Runtime.OutOfMemory in PlatformReport event from Lambda telemetry API
Go: max memory used == memory size
For Node, we are not also using max memory used == memory size (in addition to runtime-specific log message) to avoid double counting.
However, in your case, seems JavaScript heap out of memory or Runtime exited with error: signal: killed logs were not emitted for your function. Do you see any other symptom of OOM besides max memory used == memory size? If yes, then we can consider using that to capture OOM as well.
Hi,
Unfortunately, no. I was also hoping to see something along the lines of signal: killed, but the only thing we can see is a timeout.
That said, your documentation suggests there may be some inconsistencies with this specific metric, and recommends reaching out here if we encounter this kind of case?
That said, your documentation suggests there may be some inconsistencies with this specific metric, and recommends reaching out here if we encounter this kind of case?
Yes, that statement in the doc was added by me. Let me do some investigation.
The PR is merged and will be released in v98 (maybe in 2–3 weeks). With that, when max memory used == memory size, the metric aws.lambda.enhanced.out_of_memory will be emitted.
Regarding the scenario "where memory was very close to the limit", this sounds like a new feature request, and I'm not sure whether it's a good feature to add right now. As an alternative, have you explored setting up a Datadog monitor using aws.lambda.enhanced.max_memory_used and aws.lambda.memory_size? You can start by checking the pre-defined metric query "Max Memory Used/Memory Size" on the Lambda side panel.
Hi @lym953
Yes we've this now and we have got the below logs REPORT RequestId: 6a6d9d35-8015-4333-aebe-782127c2ae33 Duration: 10945.21 ms Billed Duration: 10946 ms Memory Size: 192 MB Max Memory Used: 192 MB Status: error Error Type: Runtime.OutOfMemory
One thing I wanted to clarify, although I haven’t tested this yet: previously, when a Lambda went OOM, the agent wasn’t reporting those logs to Datadog, so they were only available in CloudWatch Logs. Is that still the case?
Likely yes because I don't expect my latest PR to affect this behavior.
To be specific, in your case, if multiple back-to-back invocations went OOM, I expect the log you mentioned to be missing only for the last invocation. For example, that log for the 1st invocation should be captured by the extension when the 2nd started. However, the log for the last invocation might be lost. Is that what you see?
Yeah, I was trying to understand whether the logs would still be available in Datadog when the Lambda fails due to OOM.
Basically, I’m asking whether the agent would still be able to fire the logs to Datadog before the function dies, or whether those logs would only be available in CloudWatch?
e.g this log line or similar REPORT RequestId: 77415041-e184-4246-8c0a-c7e306d359b0 Duration: 13956.16 ms Billed Duration: 13957 ms Memory Size: 192 MB Max Memory Used: 192 MB Status: error Error Type: Runtime.OutOfMemory
Ok os based on my findings, I tested this by intentionally causing a function to OOM.
What I observed is that we are getting a log entry in Datadog, as shown in the screenshot below
However, in CloudWatch Logs, I can see this log entry for OOM.
REPORT RequestId: 77415041-e184-4246-8c0a-c7e306d359b0 Duration: 13956.16 ms Billed Duration: 13957 ms Memory Size: 192 MB Max Memory Used: 192 MB Status: error Error Type: Runtime.OutOfMemory
We are currently discussing whether we need to ingest the CloudWatch logs into Datadog specifically for OOM scenarios. We are a bit hesitant because we are already being alerted through the existing monitors, and the main thing missing in Datadog is the explicit Runtime.OutOfMemory error type.
I am also not sure whether there is a way to ingest CloudWatch logs into Datadog only for this specific scenario. Otherwise, ingesting broader CloudWatch logs could have a significant cost implication.
What’s your take on this? Do you think it is worth ingesting the CloudWatch logs for this, or should we rely on the existing Datadog monitors we can do with the missing Runtime.OutOfMemory details?
The two logs you shared (one from CloudWatch Logs, one from Datadog) are not from the same request. Is that a mistake?
I am also not sure whether there is a way to ingest CloudWatch logs into Datadog only for this specific scenario. Otherwise, ingesting broader CloudWatch logs could have a significant cost implication.
I don't know a way to ingest logs just for this scenario. Datadog forwarder should be able to capture all the CloudWatch logs including those for this scenario, but I agree it's an overkill.
What’s your take on this? Do you think it is worth ingesting the CloudWatch logs for this, or should we rely on the existing Datadog monitors we can do with the missing Runtime.OutOfMemory details?
I think it depends on what you want to achieve. For example, if you want to:
get alerted when OOM happens, and
check some samples of error messages and failed invocations
then an inaccurate aws.lambda.out_of_memory metric and partial exception logs may still help achieve the goal to a large extent, though monitor threshold can be affected.
Do you think you can achieve most of what you want given the current constraints?
Basically, I’m asking whether the agent would still be able to fire the logs to Datadog before the function dies, or whether those logs would only be available in CloudWatch?
In some cases, OOM kills the extension, so the logs would only be available in CloudWatch and not in Datadog.
Activity
[-]aws.lambda.enhanced.out_of_memory not emitted when Lambda reaches memory limit but AWS reports invocation as timeout[/-][+]aws.lambda.enhanced.out_of_memory not emitted when Lambda reaches memory limit but AWS reports as timeout[/+]lym953 commentedon May 22, 2026
Thanks for the report!
OOMs are tricky to capture, and here's how we currently capture OOMs for each runtime:
JavaScript heap out of memory, orRuntime exited with error: signal: killedjava.lang.OutOfMemoryErrorOutOfMemoryExceptionRuntime.OutOfMemoryinPlatformReportevent from Lambda telemetry APImax memory used == memory sizeFor Node, we are not also using
max memory used == memory size(in addition to runtime-specific log message) to avoid double counting.However, in your case, seems
JavaScript heap out of memoryorRuntime exited with error: signal: killedlogs were not emitted for your function. Do you see any other symptom of OOM besidesmax memory used == memory size? If yes, then we can consider using that to capture OOM as well.Hamdi-Hassan-seccl commentedon May 25, 2026
Hi,
Unfortunately, no. I was also hoping to see something along the lines of
signal: killed,but the only thing we can see is a timeout.That said, your documentation suggests there may be some inconsistencies with this specific metric, and recommends reaching out here if we encounter this kind of case?
lym953 commentedon May 26, 2026
Yes, that statement in the doc was added by me. Let me do some investigation.
lym953 commentedon May 29, 2026
I'm still working on this.
test(integration): bump OOM test memory to 256 MB so extension surviv…
[SVLS-9175] feat: emit OOM metric on memory equality with per-request…
lym953 commentedon Jun 5, 2026
The PR is merged and will be released in v98 (maybe in 2–3 weeks). With that, when
max memory used == memory size, the metricaws.lambda.enhanced.out_of_memorywill be emitted.Regarding the scenario "where memory was very close to the limit", this sounds like a new feature request, and I'm not sure whether it's a good feature to add right now. As an alternative, have you explored setting up a Datadog monitor using
aws.lambda.enhanced.max_memory_usedandaws.lambda.memory_size? You can start by checking the pre-defined metric query "Max Memory Used/Memory Size" on the Lambda side panel.Hamdi-Hassan-seccl commentedon Jun 16, 2026
Thank you @lym953 for looking into this, looking forward for the fix 🤞🏻
lym953 commentedon Jun 26, 2026
v98 is out! Could you try it?
Hamdi-Hassan-seccl commentedon Jun 30, 2026
Hi @lym953
Yes we've this now and we have got the below logs
REPORT RequestId: 6a6d9d35-8015-4333-aebe-782127c2ae33 Duration: 10945.21 ms Billed Duration: 10946 ms Memory Size: 192 MB Max Memory Used: 192 MB Status: error Error Type: Runtime.OutOfMemoryOne thing I wanted to clarify, although I haven’t tested this yet: previously, when a Lambda went OOM, the agent wasn’t reporting those logs to Datadog, so they were only available in CloudWatch Logs. Is that still the case?
lym953 commentedon Jun 30, 2026
Likely yes because I don't expect my latest PR to affect this behavior.
To be specific, in your case, if multiple back-to-back invocations went OOM, I expect the log you mentioned to be missing only for the last invocation. For example, that log for the 1st invocation should be captured by the extension when the 2nd started. However, the log for the last invocation might be lost. Is that what you see?
Hamdi-Hassan-seccl commentedon Jun 30, 2026
Yeah, I was trying to understand whether the logs would still be available in Datadog when the Lambda fails due to OOM.
Basically, I’m asking whether the agent would still be able to fire the logs to Datadog before the function dies, or whether those logs would only be available in CloudWatch?
e.g this log line or similar
REPORT RequestId: 77415041-e184-4246-8c0a-c7e306d359b0 Duration: 13956.16 ms Billed Duration: 13957 ms Memory Size: 192 MB Max Memory Used: 192 MB Status: error Error Type: Runtime.OutOfMemoryDoes that make any sense?
Hamdi-Hassan-seccl commentedon Jul 1, 2026
Ok os based on my findings, I tested this by intentionally causing a function to OOM.
What I observed is that we are getting a log entry in Datadog, as shown in the screenshot below
REPORT RequestId: 77415041-e184-4246-8c0a-c7e306d359b0 Duration: 13956.16 ms Billed Duration: 13957 ms Memory Size: 192 MB Max Memory Used: 192 MB Status: error Error Type: Runtime.OutOfMemoryWe are currently discussing whether we need to ingest the CloudWatch logs into Datadog specifically for OOM scenarios. We are a bit hesitant because we are already being alerted through the existing monitors, and the main thing missing in Datadog is the explicit Runtime.OutOfMemory error type.
I am also not sure whether there is a way to ingest CloudWatch logs into Datadog only for this specific scenario. Otherwise, ingesting broader CloudWatch logs could have a significant cost implication.
What’s your take on this? Do you think it is worth ingesting the CloudWatch logs for this, or should we rely on the existing Datadog monitors we can do with the missing
Runtime.OutOfMemorydetails?lym953 commentedon Jul 1, 2026
The two logs you shared (one from CloudWatch Logs, one from Datadog) are not from the same request. Is that a mistake?
I don't know a way to ingest logs just for this scenario. Datadog forwarder should be able to capture all the CloudWatch logs including those for this scenario, but I agree it's an overkill.
I think it depends on what you want to achieve. For example, if you want to:
then an inaccurate
aws.lambda.out_of_memorymetric and partial exception logs may still help achieve the goal to a large extent, though monitor threshold can be affected.Do you think you can achieve most of what you want given the current constraints?
lym953 commentedon Jul 1, 2026
In some cases, OOM kills the extension, so the logs would only be available in CloudWatch and not in Datadog.