-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
to address #3918, reuse a container on applicationError #3941
to address #3918, reuse a container on applicationError #3941
Conversation
case Left(error) => Future.failed(error) | ||
case Right(act) => Future.successful(act) | ||
//if non-successful, init failures should fail, and non-applicationErrors should also fail | ||
case Right((act, initFailure)) if !act.response.isSuccess && (initFailure || !act.response.isApplicationError) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this a little bit more straightforward and reduce the size of the change, does it make sense to change https://github.com/apache/incubator-openwhisk/blob/master/common/scala/src/main/scala/whisk/core/containerpool/Container.scala#L114 to be a containerError
? That way, I think all init failures are non-application errors and thus you can just check for isSuccess | isApplicationError
here vs. having to thread the extra boolean flag through.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable! 👍
Codecov Report
@@ Coverage Diff @@
## master #3941 +/- ##
==========================================
- Coverage 85.61% 80.75% -4.87%
==========================================
Files 147 146 -1
Lines 7107 7058 -49
Branches 429 418 -11
==========================================
- Hits 6085 5700 -385
- Misses 1022 1358 +336
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding a test!
collector.calls should have size 2 | ||
container.suspendCount shouldBe 0 | ||
acker.calls should have size 2 | ||
store.calls should have size 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a remove
check that equals 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PG2 3484 ⏳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but have a question about the new test, I don't understand the active ack checks.
acker.calls should have size 2 | ||
store.calls should have size 2 | ||
|
||
val initErrorActivation = acker.calls(0)._2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are you testing here? I don't follow the rest of the checks here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the same (except the first run failure) assertions as in the run an action and continue with a next run without pausing the container
test; I added a comment to indicate this
@csantanapr any comments on this one? |
Hi, I'm wondering what's the rationale behind throwing different types of errors when there's a timeout during init and run phases. Some thoughts:
|
Good questions @mgencur. I agree, a timeout on run should be made a container-error (aka action-developer-error) as well. We can see it as an uncaught exception as the action can and should be aware of its own time limits. On the containerError -> application-developer-error confusion: I agree, feel free to rename the internal methods as you see fit (developerError maybe fo readability?). The translation is weird and non-obvious. |
It’s better - would you want to reuse the container if it timed out? You’d end up with a concurrent activation for example. +1 |
Is there a test existing for timeout on run? I don't see one but will try to add it (please let me know if you think it already exists) I can take a stab at renaming containerError -> developerError, but I think this is also used for docker and other host-related errors:
I'm not sure these are strictly under control of developer - does that matter? |
I think there is such a test I’ll try to find it. |
All the tests are updated; let me know if you have other comments? |
Whoops this fell through the cracks, sorry. Any last words @rabbah? PG1 3270 ⌛️ |
@tysonnorris can you please rebase this to the latest and greatest? |
…turned during /run
…ad of ApplicationResponse.applicationError)
…vationResponse.developerError)
…vationResponse.developerError)
…vationResponse.developerError)
544d94b
to
6b9f24b
Compare
@tysonnorris is this CLI PR the extent of the changes needed for the CLI to facilitate this incubator PR? or do I need to worry about all the pre-existing |
@drcariel AFAIK |
Fixes apache#3918 Renamed `ActivationResponse.containerError` -> `ActivationResponse.developerError` * generate ApplicationResponse.containerError during failed init (instead of ApplicationResponse.applicationError) * timeout on run now produces `ActivationResponse.containerError`
Reuse a container on applicationError (graceful error from action), only during /run (any error during /init still destroys the container)
Description
In the Future handling of
ContainerProxy.initializeAndRun()
, this adjustment will allow container to NOT be destroyed when applicationError is returned from the /run request.This affects warm container reuse in the case where an anticipated error should produce an error result, but should have no impact on container reuse (container is still valid to process next activation).
Example use case is parameter validation where some sanity check is performed at the start of the action code, and immediately returns
{error: "invalid parameter"}
.This will
I considered, but did NOT implement, a change to
WhiskActivation
to add a field that indicates /init failure - since I think it can only be detected in activation logs whether the applicationError response was during /init vs /run, and it may be useful for action developers to have easier access to this bit of info. Sone of the code is convoluted to track the distinction between applicationError on /init and applicationError on /run (e.g.WhiskActivation
becomes(WhiskActivation, Boolean)
).Related issue and scope
My changes affect the following components
Types of changes
Checklist: