From 2e00acc17b6a856a0ce2d5bf61909536c700c8e9 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Mon, 21 Mar 2022 11:25:08 +0000 Subject: [PATCH] Increase Execution output limit to 1MB --- app/config/collections.php | 8 ++++---- app/executor.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/config/collections.php b/app/config/collections.php index 98f41e8833..fc7af6b7c7 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -2007,7 +2007,7 @@ $collections = [ '$id' => 'stderr', 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 1048576, 'signed' => true, 'required' => false, 'default' => '', @@ -2018,7 +2018,7 @@ $collections = [ '$id' => 'stdout', 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 1048576, 'signed' => true, 'required' => false, 'default' => '', @@ -2124,7 +2124,7 @@ $collections = [ '$id' => 'stdout', 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 1048576, 'signed' => true, 'required' => false, 'default' => null, @@ -2135,7 +2135,7 @@ $collections = [ '$id' => 'stderr', 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 16384, + 'size' => 1048576, 'signed' => true, 'required' => false, 'default' => null, diff --git a/app/executor.php b/app/executor.php index f882164d16..0585ca7287 100644 --- a/app/executor.php +++ b/app/executor.php @@ -283,8 +283,8 @@ App::post('/v1/runtimes') $endTime = \time(); $container = array_merge($container, [ 'status' => 'ready', - 'stdout' => \utf8_encode($stdout), - 'stderr' => \utf8_encode($stderr), + 'stdout' => \mb_substr(\utf8_encode($stdout), 0, 1048576), // Limit to 1MB + 'stderr' => \mb_substr(\utf8_encode($stderr), 0, 1048576), // Limit to 1MB 'startTime' => $startTime, 'endTime' => $endTime, 'duration' => $endTime - $startTime, @@ -501,8 +501,8 @@ App::post('/v1/execution') $execution = [ 'status' => $functionStatus, 'statusCode' => $statusCode, - 'stdout' => \utf8_encode(\mb_substr($stdout, -16384)), - 'stderr' => \utf8_encode(\mb_substr($stderr, -16384)), + 'stdout' => \mb_substr(\utf8_encode($stdout), 0, 1048576), // Limit to 1MB + 'stderr' => \mb_substr(\utf8_encode($stderr), 0, 1048576), // Limit to 1MB 'time' => $executionTime, ];