Hello Openwhisk community members,

recently, PR #4390 [1] renamed runtime kind "java" to "java:8". While a 
change like this looks harmless at the first sight, it breaks all existing 
actions of this kind. This may not be important for developers and 
"occasional" usage of Openwhisk - but it affects production deployments. 
Production deployments with existing actions require additional migration 
steps when renaming or removing runtime kinds.

I opened PR #4627 to improve documentation. Said PR also adds 
"documentation" to the pre-defined Openwhisk runtime manifest files to 
make developers aware that renaming or removing runtime kinds can cause 
problems.

There is another area that should be improved - but I need help to better 
understand this area...


When trying to create an action with a kind that does not exist, a 
reasonable error message is created:

$ wsk action create kind-does-not-exist tests/dat/actions/hello.js --kind 
nodejs:4
error: Unable to create action 'kind-does-not-exist': The request content 
was malformed:
kind 'nodejs:4' not in Set(dotnet:2.2, go:1.11, nodejs:10, 
ballerina:0.990, ruby:2.5, nodejs:18, blackbox, swift:4.2, java:8, 
sequence, nodejs:6, nodejs:12, python:3, python:2, php:7.3) (code 
33bfb55ce44d1dd0bc6e662c49ea9391)


When trying to display an action's metadata which has a kind that does not 
exist, the resulting error message is not helpful at all:

$ wsk action get kind-does-not-exist
error: Unable to get action 'kind-does-not-exist': Resource by this name 
exists but is not in this collection. (code 
4761468230c344417fd61cdca5922e52)


* My conclusion from looking into controller log's and code is that 
deserialization of the ExecMetaDataBase object fails with a 
DeserializationException [3].
* This exception fails the "try" block in StoreUtils.deserialize() leading 
to a fall-back read in the "catch" block. This fall-back read seems to 
return a WhiskTrigger instead of a WhiskActionMetaData so that a 
DocumentTypeMismatchException is thrown [4].
  The resulting message can be found in controller logs: "document type 
class org.apache.openwhisk.core.entity.WhiskTrigger did not match expected 
type class org.apache.openwhisk.core.entity.WhiskActionMetaData.".
* As a result, getEntity() fails with the misleading error message 
mentioned above and HTTP status code 409 (Conflict).

Can somebody explain why [4] has a fall-back and which scenarios are 
addressed by this?

In our scenario, ExecMetaDataBase should probably throw an 
UnknownRuntimeKindException and StoreUtils.deserialize() should not have a 
fall-back for this exception.


[1] https://github.com/apache/openwhisk/pull/4390
[2] https://github.com/apache/openwhisk/pull/4627
[3] 
https://github.com/apache/openwhisk/blob/2036548e62dbf959d91c2328e86318bd7cfa656f/common/scala/src/main/scala/org/apache/openwhisk/core/entity/Exec.scala#L445-L450
[4] 
https://github.com/apache/openwhisk/blob/2036548e62dbf959d91c2328e86318bd7cfa656f/common/scala/src/main/scala/org/apache/openwhisk/core/database/StoreUtils.scala#L58-L67
[5] 
https://github.com/apache/openwhisk/blob/be1e3a19c02956c9be85023a0bb0ff399c21444d/core/controller/src/main/scala/org/apache/openwhisk/core/controller/ApiUtils.scala#L148-L150


Mit freundlichen Grüßen / Regards,

Sven Lange-Last
Senior Software Engineer
IBM Cloud Functions
Apache OpenWhisk


E-mail: sven.lange-l...@de.ibm.com
Find me on:  


Schoenaicher Str. 220
Boeblingen, 71032
Germany




IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, 
HRB 243294


Reply via email to