You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/01/07 20:42:46 UTC

[GitHub] rabbah closed pull request #4156: Make exec aka code max size configurable

rabbah closed pull request #4156: Make exec aka code max size configurable
URL: https://github.com/apache/incubator-openwhisk/pull/4156
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/scala/src/main/resources/application.conf b/common/scala/src/main/resources/application.conf
index 1f31d83cd0..40c98a70c2 100644
--- a/common/scala/src/main/resources/application.conf
+++ b/common/scala/src/main/resources/application.conf
@@ -234,6 +234,9 @@ whisk {
         std = 1
     }
 
+    # maximum size of the action code
+    exec-size-limit = 48 m
+
     query-limit {
         max-list-limit     = 200  # max number of entities that can be requested from a collection on a list operation
         default-list-limit = 30   # default limit on number of entities returned from a collection on a list operation
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
index 019f37f4be..8dd78107ab 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/WhiskConfig.scala
@@ -239,5 +239,6 @@ object ConfigKeys {
 
   val s3 = "whisk.s3"
   val query = "whisk.query-limit"
+  val execSizeLimit = "whisk.exec-size-limit"
 
 }
diff --git a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala
index c5b13c1afa..f228e2e8e7 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala
@@ -19,15 +19,17 @@ package org.apache.openwhisk.core.entity
 
 import java.nio.charset.StandardCharsets
 
-import scala.language.postfixOps
-import scala.util.matching.Regex
+import org.apache.openwhisk.core.ConfigKeys
 
+import scala.util.matching.Regex
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import org.apache.openwhisk.core.entity.Attachments._
 import org.apache.openwhisk.core.entity.ExecManifest._
 import org.apache.openwhisk.core.entity.size.SizeInt
+import org.apache.openwhisk.core.entity.size._
 import org.apache.openwhisk.core.entity.size.SizeString
+import pureconfig.loadConfigOrThrow
 
 /**
  * Exec encodes the executable details of an action. For black
@@ -227,7 +229,12 @@ protected[core] case class SequenceExecMetaData(components: Vector[FullyQualifie
 
 protected[core] object Exec extends ArgNormalizer[Exec] with DefaultJsonProtocol {
 
-  val sizeLimit = 48 MB
+  val maxSize: ByteSize = 48.MB
+  val sizeLimit = loadConfigOrThrow[ByteSize](ConfigKeys.execSizeLimit)
+
+  require(
+    sizeLimit <= maxSize,
+    s"Executable code size limit $sizeLimit specified by '${ConfigKeys.execSizeLimit}' should not be more than max size of $maxSize")
 
   // The possible values of the JSON 'kind' field for certain runtimes:
   // - Sequence because it is an intrinsic
@@ -360,8 +367,6 @@ protected[core] object Exec extends ArgNormalizer[Exec] with DefaultJsonProtocol
 
 protected[core] object ExecMetaDataBase extends ArgNormalizer[ExecMetaDataBase] with DefaultJsonProtocol {
 
-  val sizeLimit = 48 MB
-
   // The possible values of the JSON 'kind' field for certain runtimes:
   // - Sequence because it is an intrinsic
   // - Black Box because it is a type marker
diff --git a/docs/reference.md b/docs/reference.md
index 7feaa6f8f6..c1a3adbb2e 100644
--- a/docs/reference.md
+++ b/docs/reference.md
@@ -81,7 +81,7 @@ The following table lists the default limits for actions.
 | logs | a container is not allowed to write more than N MB to stdout | per action | MB | 10 |
 | concurrent | no more than N activations may be submitted per namespace either executing or queued for execution | per namespace | number | 100 |
 | minuteRate | no more than N activations may be submitted per namespace per minute | per namespace | number | 120 |
-| codeSize | the maximum size of the actioncode | not configurable, limit per action | MB | 48 |
+| codeSize | the maximum size of the actioncode | configurable, limit per action | MB | 48 |
 | parameters | the maximum size of the parameters that can be attached | not configurable, limit per action/package/trigger | MB | 1 |
 | result | the maximum size of the action result | not configurable, limit per action | MB | 1 |
 
@@ -100,7 +100,7 @@ The following table lists the default limits for actions.
 * A user can change the limit when creating or updating the action.
 * Logs that exceed the set limit are truncated and a warning is added as the last output of the activation to indicate that the activation exceeded the set log limit.
 
-### Per action artifact (MB) (Fixed: 48MB)
+### Per action artifact (MB) (Default: 48MB)
 * The maximum code size for the action is 48MB.
 * It is recommended for a JavaScript action to use a tool to concatenate all source code including dependencies into a single bundled file.
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services