com.aws.greengrass.lambdamanager.StatusTimeoutException mysterious lambda error

0

I am trying to use lambdas on greengrass v2. I created and packaged the hello world lambda from the greengrass tutorial and deployed it to the core but it continues to error out. It doesnt seem to run to completion, or the lambda isnt getting called correctly and the core reports it as timed out. This is the stacktrace. How do I get this lambda to work in greeengrass v2?

com.aws.greengrass.lambdamanager.StatusTimeoutException: Lambda status not received within timeout at com.aws.greengrass.lambdamanager.Lambda.lambda$createInstanceKeepAliveTask$5(Lambda.java:282) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

aws.greengrass.LambdaManager 2.2.2 using Python Python 3.7

With the following hello world lambda

import json
import awsiot.greengrasscoreipc
import awsiot.greengrasscoreipc.client as client
from awsiot.greengrasscoreipc.model import (
    QOS,
    PublishToIoTCoreRequest
)

TIMEOUT = 10

ipc_client = awsiot.greengrasscoreipc.connect()

def greengrass_hello_world_run():
    topic = "my/topic"
    message = "Hello, World"
    qos = QOS.AT_LEAST_ONCE

request = PublishToIoTCoreRequest()
request.topic_name = topic
request.payload = bytes(message, "utf-8")
request.qos = qos
operation = ipc_client.new_publish_to_iot_core()
operation.activate(request)
future = operation.get_response()
future.result(TIMEOUT)
Timer(5, greengrass_hello_world_run).start()
greengrass_hello_world_run()

def lambda_handler(event, context):
    return
已提问 2 年前454 查看次数
1 回答
1

Hi,

The common cause for the status timeout is that your memory limit is set too low on the lambda, and so Linux kills the container, thus the status doesn't update. You can address this by changing the memory limit when creating your component version or by updating the configuration in a deployment. If you create a new Greengrass component version to update the memory limit you must use "reset": [""] in the configurationUpdate for the deployment in order for the new default values to be used. https://docs.aws.amazon.com/greengrass/v2/developerguide/update-component-configurations.html#reset-configuration-update

If the above does not solve your issue, please provide the version of Lambda manager which is being used, and if you are not using the latest version, then do use the latest version. Please also provide the lambda language (Python, NodeJS, or Java).

AWS
专家
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则