Skip to content

Commit

Permalink
fix(serverless-spoke): extend stdout buffer to avoid process being ki…
Browse files Browse the repository at this point in the history
…lled (UMAprotocol#3857)

Signed-off-by: Matt Rice <[email protected]>
  • Loading branch information
mrice32 authored Mar 23, 2022
1 parent 06d4178 commit 4f67e4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/serverless-orchestration/src/ServerlessSpoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ let customLogger;

const waitForLoggerDelay = process.env.WAIT_FOR_LOGGER_DELAY || 5;

// To be used with exec to override the default input output buffer size.
// 1024 * 1024 is the default.
// This is 1024 * 1024 * 8.
const maxBuffer = 8388608;

spoke.post("/", async (req, res) => {
// Use a custom logger if provided. Otherwise, initialize a local logger.
// Note: no reason to put this into the try-catch since a logger is required to throw the error.
Expand Down Expand Up @@ -95,7 +100,7 @@ function _execShellCommand(cmd, inputEnv, strategyRunnerSpoke = false) {
return new Promise((resolve) => {
const { stdout, stderr } = exec(
cmd,
{ env: { ...process.env, ...inputEnv }, stdio: "inherit" },
{ env: { ...process.env, ...inputEnv }, stdio: "inherit", maxBuffer },
(error, stdout, stderr) => {
// The output from the process execution contains punctuation marks and escape chars that should be stripped.
stdout = _stripExecStdout(stdout, strategyRunnerSpoke);
Expand Down

0 comments on commit 4f67e4d

Please sign in to comment.