apache/openwhisk-runtime-php

add mode to disable re-init of an action

rabbah opened this issue · 3 comments

The Java proxy does not permit an action to be re-initialized [1]. This isn't true for the PHP runtime. All the runtimes should behave consistently. The basic action container tests suite will be extended to include a test for re-init, where the first init is expected to succeed but the second should fail. The action proxy will reject the request with status code 403 FORBIDDEN (although any non-20x is acceptable for rejection).

[1] https://github.com/apache/incubator-openwhisk-runtime-java/blob/3657b3889fd1ce03581184fcb07766a8c897a4d8/java8/proxy/src/main/java/openwhisk/java/action/Proxy.java#L72-L75

What's the rationale for preventing a re-initialisation? Something to do with the state that the other runtimes hold between requests?

The invoker maintains the contract that init is called once (from the outside). So re-init from the invoker would be an error (should not happen) and the proxies should all have a consistent behavior on re-init. Another is re-init from within the action; while there are some legitimate use cases for this following from an actor model, or reusing a container for local dev and debug, or loosening the one container-one function constraint in some deployments, we should have a mode for init once that’s consistent again for all the runtimes.