Skip to content

Commit

Permalink
switch strategy into force exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
rnegron committed Oct 23, 2024
1 parent fc049bf commit f850104
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/core/src/tools/create-lambda-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,18 @@ const createLambdaHandler = (appRawOrPath) => {
ZapierPromise.patchGlobal();
}

// If we're running out of memory, exit the process. Backend will try again.
// If we're running out of memory or file descriptors, force exit the process.
// The backend will try again via @retry(ProcessExitedException).
try {
checkMemory(event);
} catch (err) {
// Don't crash the invocation if we can't check memory usage.
if (err.code === 'EMFILE') {
console.error('Too many open files, skipping memory usage check...');
console.error(
'Force killing process by Zapier for too many open file descriptors'
);

/* eslint no-process-exit: 0 */
process.exit(1);
} else {
throw err;
}
Expand Down

0 comments on commit f850104

Please sign in to comment.