Skip to content

Commit

Permalink
Log outputGate broken shouldRetryCountsAgainstLimits for alarms. Forc…
Browse files Browse the repository at this point in the history
…e exceeded memory overloaded error to be treated as user error
  • Loading branch information
jqmmes committed Nov 28, 2024
1 parent d21c3b8 commit d76d464
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/workerd/api/global-scope.c++
Original file line number Diff line number Diff line change
Expand Up @@ -471,16 +471,17 @@ kj::Promise<WorkerInterface::AlarmResult> 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,
Expand Down Expand Up @@ -511,16 +512,16 @@ kj::Promise<WorkerInterface::AlarmResult> 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,
Expand Down

0 comments on commit d76d464

Please sign in to comment.