You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwhisk.apache.org by Michele Sciabarra <op...@sciabarra.com> on 2018/03/18 11:27:19 UTC

What to do when an action cannot continue?

Scenario: an action (in this case a Go action but it can be in any language actually) find a condition where it cannot continue. For example, an out-of-memory (not at all usual in the constrained environment where an action is executed). What to do then?

I want the action to be destroyed and recreated but how do I notify the error condition when an "/run" is executed? What happens if I return an error code different that 200? 

In my case, I am trying to decide what to do when the proxy detects that the underlying process died. I am wondering if there are conditions when I should try to restart it or I do better to ask to the Invoker to get rid of the corpse and create a new one.

-- 
  Michele Sciabarra
  openwhisk@sciabarra.com

Re: What to do when an action cannot continue?

Posted by Rodric Rabbah <ro...@gmail.com>.
The memory limits are imposed “from outside” the container. If an action exceeds its allocated max memory the container is killed (by docker) and the invoker detects the reason as OOM. The invoke of the action will result in a new container and process.

In general if an action dies, the expectation is that the http connection to the container from the invoker is severed. This indicates an error that reclaims the container. 

If you want to handle the error inside the container and return an error response (instead of just failing completely) then you’ll need to detect the process died and recover it. I’m not sure it’s worth the complexity to do that compared to what the system already does.  

-r

> On Mar 18, 2018, at 7:27 AM, Michele Sciabarra <op...@sciabarra.com> wrote:
> 
> Scenario: an action (in this case a Go action but it can be in any language actually) find a condition where it cannot continue. For example, an out-of-memory (not at all usual in the constrained environment where an action is executed). What to do then?
> 
> I want the action to be destroyed and recreated but how do I notify the error condition when an "/run" is executed? What happens if I return an error code different that 200? 
> 
> In my case, I am trying to decide what to do when the proxy detects that the underlying process died. I am wondering if there are conditions when I should try to restart it or I do better to ask to the Invoker to get rid of the corpse and create a new one.
> 
> -- 
>  Michele Sciabarra
>  openwhisk@sciabarra.com