ruediger-maass commented on a change in pull request #4299: Avoid that actions
do not stop after action timeout when logging heavily
URL:
https://github.com/apache/incubator-openwhisk/pull/4299#discussion_r260733562
##########
File path:
common/scala/src/main/scala/org/apache/openwhisk/core/containerpool/logging/DockerToActivationFileLogStore.scala
##########
@@ -123,7 +123,16 @@ class DockerToActivationFileLogStore(system: ActorSystem,
destinationDirectory:
container: Container,
action: ExecutableWhiskAction):
Future[ActivationLogs] = {
- val logs = container.logs(action.limits.logs.asMegaBytes,
action.exec.sentinelledLogs)(transid)
+ // wait for a sentinel only if no container (developer) error occurred to
avoid
+ // that log collection continues if the action code still logs after
timeout
+ val isContainerTimeoutError =
activation.response.isContainerTimeoutError(action.limits.timeout.duration)
+ val sentinel = action.exec.sentinelledLogs && !isContainerTimeoutError
+
+ val logs = container.logs(action.limits.logs.asMegaBytes,
sentinel)(transid)
+ val logsWithPossibleError = if (isContainerTimeoutError) {
+ logs.concat(
+ Source.single(ByteString(LogLine(Instant.now.toString, "stderr",
Messages.logFailure).toJson.compactPrint)))
Review comment:
in the tests the appendend line `Messages.logFailure` was always looking
good, so not sure if an additional newline would be required
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services