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
1 Answer
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
EXPERT
answered 2 years ago
  • I have updated the question. Sorry about the formatting.

  • Please try my suggested solution, and then let me know how it goes.

  • Turns out it works, but gives errors in cloudwatch.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions