From d76d46427866ad7c47255316f9ae96a2977d571f Mon Sep 17 00:00:00 2001 From: Joaquim Silva Date: Thu, 28 Nov 2024 15:08:17 +0000 Subject: [PATCH] Log outputGate broken shouldRetryCountsAgainstLimits for alarms. Force exceeded memory overloaded error to be treated as user error --- src/workerd/api/global-scope.c++ | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/workerd/api/global-scope.c++ b/src/workerd/api/global-scope.c++ index e3072b957cd..cfee9034790 100644 --- a/src/workerd/api/global-scope.c++ +++ b/src/workerd/api/global-scope.c++ @@ -471,16 +471,17 @@ kj::Promise ServiceWorkerGlobalScope::runAlarm(kj: !jsg::isDoNotLogException(desc) && context.isOutputGateBroken()) { LOG_NOSENTRY(ERROR, "output lock broke during alarm execution", actorId, e); } else if (context.isOutputGateBroken()) { - // We don't usually log these messages, but it's useful to know the real reason we failed - // to correctly investigate stuck alarms. - LOG_NOSENTRY(ERROR, - "output lock broke during alarm execution without an interesting error description", - actorId, e); if (e.getDetail(jsg::EXCEPTION_IS_USER_ERROR) != kj::none) { // The handler failed because the user overloaded the object. It's their fault, we'll not // retry forever. shouldRetryCountsAgainstLimits = true; } + + // We don't usually log these messages, but it's useful to know the real reason we failed + // to correctly investigate stuck alarms. + LOG_NOSENTRY(ERROR, + "output lock broke during alarm execution without an interesting error description", + actorId, e, shouldRetryCountsAgainstLimits); } return WorkerInterface::AlarmResult{.retry = true, .retryCountsAgainstLimit = shouldRetryCountsAgainstLimits, @@ -511,16 +512,16 @@ kj::Promise ServiceWorkerGlobalScope::runAlarm(kj: LOG_NOSENTRY(ERROR, "output lock broke after executing alarm", actorId, e); } } else { - // We don't usually log these messages, but it's useful to know the real reason we failed - // to correctly investigate stuck alarms. - LOG_NOSENTRY(ERROR, - "output lock broke after executing alarm without an interesting error description", - actorId, e); if (e.getDetail(jsg::EXCEPTION_IS_USER_ERROR) != kj::none) { // The handler failed because the user overloaded the object. It's their fault, we'll not // retry forever. shouldRetryCountsAgainstLimits = true; } + // We don't usually log these messages, but it's useful to know the real reason we failed + // to correctly investigate stuck alarms. + LOG_NOSENTRY(ERROR, + "output lock broke after executing alarm without an interesting error description", + actorId, e, shouldRetryCountsAgainstLimits); } return WorkerInterface::AlarmResult{.retry = true, .retryCountsAgainstLimit = shouldRetryCountsAgainstLimits,