TerminationGracePeriodSeconds 不适用于 KEDA 的队列触发功能 [英] terminationGracePeriodSeconds not working for queue triggered function with KEDA

查看:215
本文介绍了TerminationGracePeriodSeconds 不适用于 KEDA 的队列触发功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个启用了 KEDA 的队列触发 Azure 函数,其 terminationGracePeriodSeconds 已设置为 900 秒(15 分钟).函数执行时间在 30 秒到 600 秒(10 分钟)之间变化.所以 15 分钟的宽限期似乎是合理的.

I am running a KEDA enabled Queue Triggered Azure Function for which terminationGracePeriodSeconds has been set to 900 seconds (15 minutes). The function execution time varies between 30 seconds and 600 seconds (10 minutes). So grace period of 15 minutes seems to be reasonable.

是否有可能在发出 SIGTERM 后,如果还有一些宽限期,pod 会在完成当前请求后接受新请求.

Is there a possibility that after the SIGTERM is issued, the pod takes up a new request after finishing the current one if there is still some grace period left.

我遇到过函数执行突然停止,消息未处理的情况.

I have come across situations where the function execution stops abruptly, leaving the message unprocessed.

以下是部署中的规范:

spec:
      containers:
        - image: ####.azurecr.io/azurefunctionqueuetriggeredk8s
          name: queuetrigcontainer
          ports:
          - containerPort: 80
          resources:
            requests:
              memory: "500Mi"
              cpu: "700m"
            limits:
              memory: "600Mi"
              cpu: "700m"
      nodeSelector:
        agentpool: testuserpool
      terminationGracePeriodSeconds: 900

对这种行为有什么合理的解释吗?如何解决?

Is there any plausible explanation for this behavior? How this can be resolved?

容器日志显示应用程序正在关闭..."

The container logs show "Application is shutting down..."

推荐答案

看起来这是代码方面的未实现事件,不一定与您的配置相关.最可能的解释是 SIGTERM 没有被处理并且函数一直在处理事件,无论如何.

Looks like this is a non-implemented event on the code side, and not necessarily something related to your configuration. The most probable explanation is the SIGTERM is not handled and the function keeps processing events, no matter what.

GitHub 上有报告(https://github.com/Azure/azure-functions-host/issues/5365) 关于超时的相同情况.

There are reports here on GitHub (https://github.com/Azure/azure-functions-host/issues/5365) about kind of the same situation with a timeout.

如果您有机会处理 IApplicationLifetime 对象上的 ApplicationStoppingApplicationStopped 事件,并停止该应用程序的处理处于停止状态.

If you have the chance you could handle the ApplicationStopping and ApplicationStopped events on the IApplicationLifetime object and stop the function from processing if the app is in a stopping state.

这篇关于TerminationGracePeriodSeconds 不适用于 KEDA 的队列触发功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆