Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda No Space Left on Device error

I am using API gateway to call lambda function that imports a mpeg file (10 mb) from s3 and saves in /tmp folder of lambda and the lambda uploads it to external API (youtube etc) Recently the API gateway call to lambda is failing intermittently with error

[Errno 28] No space left on device

Here is how i am downloading the file

urllib.urlretrieve (s3_mpeg_url, '/tmp/{}'.format(mpeg_filename))

If i create a new version of that same lambda function and assign to alias API gateway pointing to , it starts to work and again at some point it keeps getting the same error

When i test that lambda function from lambda console it always works

Any idea ?

like image 206
codeexplorer Avatar asked Jan 19 '18 18:01

codeexplorer


People also ask

What happens if Lambda runs out of memory?

Duration: before the function runs out of memory, it finishes invocations at a steady double-digit millisecond rate. As paging occurs, the duration takes an order of magnitude longer.

How do you troubleshoot Lambda errors?

To troubleshoot Lambda code errors You can use CloudWatch to view all logs generated by your function's code and identify potential issues. For more information, see Accessing Amazon CloudWatch Logs for AWS Lambda.

What is the memory limit of AWS Lambda?

AWS Lambda now supports up to 10 GB of memory and 6 vCPU cores for Lambda Functions. AWS Lambda customers can now provision Lambda functions with a maximum of 10,240 MB (10 GB) of memory, a more than 3x increase compared to the previous limit of 3,008 MB.


1 Answers

Your lambda function has approximately 500MB of disk space available on /tmp. However, for performance reasons, AWS Lambda might retain and reuse instances of your function on subsequent calls. There are two possible paths you can take here:

  1. If your function is totally stateless (i.e. you don't need the mpeg file after uploading it to the external API), just delete it from the /tmp folder after the upload.
  2. If you need to keep the data around, consider storing it on another media, like S3 or DynamoDB after processing.
like image 113
Viccari Avatar answered Sep 23 '22 23:09

Viccari