Skip to content

Limit of binary actions is too low. #3835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed

Conversation

cbickel
Copy link
Contributor

@cbickel cbickel commented Jul 3, 2018

On creating an action, the code is sent to the controller. Afterwards the controller checks, that the code is not too big. If the code itself is sent directly (e.g. uploading a single .js file), the limit is 48MB (today).
If an archive is uploaded, it will be encoded with base64. The problem here is, that base64 has an overhead of 1/3. This means, if you have an archive, that has a size of e.g. 45MB, 60MB will be sent to the controller. So the request will be rejected. This is not expected for the user, as a limit of 48MB was proposed to him.

This PR fixes that bug.

Related issue and scope

  • I opened an issue to propose and discuss this change (apache-mailing-list)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@cbickel cbickel requested a review from markusthoemmes July 3, 2018 08:51
@cbickel cbickel added the review Review for this PR has been requested and yet needs to be done. label Jul 3, 2018
@rabbah
Copy link
Member

rabbah commented Jul 3, 2018

@cbickel will this PR also close #3712?

@cbickel
Copy link
Contributor Author

cbickel commented Jul 4, 2018

@rabbah Thanks for the pointer. I wasn't aware of this issue. But I think this PR will close this issue as well.

@codecov-io
Copy link

codecov-io commented Jul 6, 2018

Codecov Report

Merging #3835 into master will decrease coverage by 4.74%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3835      +/-   ##
==========================================
- Coverage   75.81%   71.06%   -4.75%     
==========================================
  Files         146      146              
  Lines        6902     6906       +4     
  Branches      428      428              
==========================================
- Hits         5233     4908     -325     
- Misses       1669     1998     +329
Impacted Files Coverage Δ
...src/main/scala/whisk/core/entity/WhiskEntity.scala 91.66% <ø> (ø) ⬆️
.../scala/src/main/scala/whisk/core/entity/Exec.scala 83.87% <100%> (+0.1%) ⬆️
.../scala/src/main/scala/whisk/core/WhiskConfig.scala 92.06% <100%> (+0.06%) ⬆️
.../scala/src/main/scala/whisk/core/entity/Size.scala 96.29% <100%> (+0.14%) ⬆️
...a/src/main/scala/whisk/core/entity/Parameter.scala 95.34% <100%> (ø) ⬆️
...core/database/cosmosdb/RxObservableImplicits.scala 0% <0%> (-100%) ⬇️
...core/database/cosmosdb/CosmosDBArtifactStore.scala 0% <0%> (-95.08%) ⬇️
...sk/core/database/cosmosdb/CosmosDBViewMapper.scala 0% <0%> (-92.6%) ⬇️
...whisk/core/database/cosmosdb/CosmosDBSupport.scala 0% <0%> (-81.82%) ⬇️
...abase/cosmosdb/CosmosDBArtifactStoreProvider.scala 0% <0%> (-58.83%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 967f005...69cd891. Read the comment docs.

@cbickel
Copy link
Contributor Author

cbickel commented Jul 9, 2018

PG5#514 🔵

@cbickel cbickel force-pushed the lim branch 2 times, most recently from 965676c to 69cd891 Compare July 16, 2018 07:55
Copy link
Member

@sven-lange-last sven-lange-last left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, very good pull request. Only minor suggestions regarding addition of tests and comment clarification.

@@ -56,6 +56,8 @@ limits:
concurrentInvocationsSystem: "{{ limit_invocations_concurrent_system | default(5000) }}"
firesPerMinute: "{{ limit_fires_per_minute | default(60) }}"
sequenceMaxLength: "{{ limit_sequence_max_length | default(50) }}"
actionCodeMb: "{{ limit_action_code_mb | default(48) }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add a comment indicating this is the net action code limit while the gross limit is 4/3 * the net limit because of Base64 encoding.

@@ -56,6 +56,8 @@ limits:
concurrentInvocationsSystem: "{{ limit_invocations_concurrent_system | default(5000) }}"
firesPerMinute: "{{ limit_fires_per_minute | default(60) }}"
sequenceMaxLength: "{{ limit_sequence_max_length | default(50) }}"
actionCodeMb: "{{ limit_action_code_mb | default(48) }}"
parametersMb: "{{ limit_parameters_mb | default(1) }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to add a comment indicating that this size limit also applies to annotations, not only to parameters. And in contrast to the action code size limit, this is a gross limit because we do not perform any Base64 encoding for parameters / annotations.

@@ -124,6 +124,10 @@
"COMPONENT_NAME": "{{ controller_name }}"
"PORT": 8080

# Allow base64 overhead of action-code, parameters and annotations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a little misleading because there is no Base64 overhead for parameters and annotations.

@@ -124,6 +124,10 @@
"COMPONENT_NAME": "{{ controller_name }}"
"PORT": 8080

# Allow base64 overhead of action-code, parameters and annotations.
"CONFIG_akka_http_server_parsing_maxContentLength": "{{ (limits.actionCodeMb | int * 4 / 3 + limits.parametersMb | int * 2) | round(0, 'ceil') | int }}m"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be valuable to add a comment that this setting does only consider the code, parameters and annotations parts in JSON messages because these are potentially the largest parts. If somebody uses very large values for code, a long name value may still overflow the message body.

@@ -328,6 +328,25 @@ class ActionLimitsTests extends TestHelpers with WskTestHelpers with WskActorSys
actionCode.delete
}

it should "succeed on creating an binary-action with binary exec which is not too big before encoding" in withAssetCleaner(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should add a test that actually invokes a very large action to make sure that the DB client in the invoker is able to GET a large action JSON. This should be a large action which is Base64 encoded.

Maybe you could also add a component test for adding / updating / deleting a large action to https://github.com/apache/incubator-openwhisk/blob/master/tests/src/test/scala/whisk/core/entity/test/DatastoreTests.scala?

@@ -10,7 +10,8 @@ events {

http {
{# allow large uploads, need to thread proper limit into here #}
client_max_body_size 50M;
# Allow base64 overhead of action-code, parameters and annotations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a little misleading because there is no Base64 overhead for parameters and annotations.

@@ -93,6 +93,30 @@ class SizeTests extends FlatSpec with Matchers {
}
}

// Multiplication
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for: 1.B * 0. What happens if you multiply with / divide by negative numbers? Should this be supported?

1.MB / 512 should be(2 KB)
}

it should "throw an exception if division is through 0" in {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... if division is by 0 ...

@sven-lange-last
Copy link
Member

A more general finding: PR #3209 introduced a configurable limit for parameters in an activation. I guess it makes sense to use the same configuration settings for parameter size and activation parameter size. Can you please check how this could be done?

@style95
Copy link
Member

style95 commented Jan 25, 2019

Is there any task in-progress regarding this issue?
Or is it superseded by #4156 ?

@rabbah
Copy link
Member

rabbah commented Feb 9, 2019

@cbickel this has rotted - what's the plan?

@cbickel
Copy link
Contributor Author

cbickel commented Feb 11, 2019

I'll close the PR for now, due to long inactivity from my side.

@cbickel cbickel closed this Feb 11, 2019
@cbickel cbickel deleted the lim branch February 11, 2019 11:46
@style95 style95 mentioned this pull request Jul 12, 2022
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Review for this PR has been requested and yet needs to be done.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants