This creates a Lambda functions for testing if they will hang after a global timeout is triggered.
The amount of memory needed to be filled varies upon how much max memory there is but the problem seems to happen around the following:
- 16% of a 128 MB to
- 13% of a 1536 MB function.
To build and deploy:
./deploy.sh <s3_bucket_name>
To trigger the behavior set the event to a map: {"timeout": 6000}
The function will stop responding if you invoke with a value that will cause a Lambda global timeout. Afterwards even if the event timeout is short enough, the function will not return again. If more memory is applied the function works again.
ARN=<function arn>
# Verify it is working
aws lambda invoke --function-name "${ARN}" --payload '{"timeout":1}' --query "LogResult" --log-type Tail --output text /dev/null | base64 -d
# Now break it
aws lambda invoke --function-name "${ARN}" --payload '{"timeout":6000}' --query "LogResult" --log-type Tail --output text /dev/null | base64 -d
# Broken
aws lambda invoke --function-name "${ARN}" --payload '{"timeout":1}' --query "LogResult" --log-type Tail --output text /dev/null | base64 -d
- petkaantonov/bluebird: Bluebird unusable in AWS Lambda / NodeJS #1341
- nervous-systems/cljs-lambda: Async functions become unreponsive if Lambda global timeout occurs #62
- Type-Zero/promise-timeout-hang: Lambda cljs hang example
- Read up on container reuse in Lambda.
- Context exit methods are deprecated Using the Earlier Node.js Runtime v0.10.42 - AWS Lambda which mentions in the transitioning to new nodejs runtime that the latest lambda wants us to use the newer callback method instead of using context object calls.
- Past report of this bug: AWS Lambda โ constant timeout when using bluebird Promise