4

I have a Python Azure Function that is inconsistently running:

enter image description here

The most recent errors show "python exited with code 137":

enter image description here

Why is this happening and how do I fix it?

This Function is running on a premium EP2 App Service Plan with 7GB of memory. Files being moved are no larger than 750MB.

UPDATE 1:

Below is an example of the memory usage profile for the timeline that the function runs are failing. Its unclear to me how moving a ~700MB file can consume ~6GB of memory.

enter image description here

5
  • 1
    Maybe you can show the code? Commented Sep 21, 2020 at 1:27
  • 1
    Python error code 137 means the process was killed. If you are not manually killing it, then it is probably the operating system terminating it, most likely due to excessive memory usage. Does memory usage exceed 7GB? Please profile the memory usage of your app from the portal using metrics. Example = stackoverflow.com/a/41403722/2048857 Commented Sep 21, 2020 at 2:31
  • @BowmanZhu, I'm unable to share the code. @TroyWitthoeft. Please see UPDATE 1 above. Commented Sep 21, 2020 at 17:53
  • Please provide a minimal reproducible example. We cannot help you without knowing what exactly you're doing. Commented Sep 21, 2020 at 19:03
  • stackoverflow.com/questions/63849052/… here is the code i'm using Commented Sep 21, 2020 at 23:36

1 Answer 1

4

This is happening because we are using too much memory. Python error code 137 typically means the process was killed due to excessive memory usage. The AppInsights memory profile showing up to 6GB memory used supports that To fix it, reduce your memory usage to keep the application from terminating. To dig deeper, we'd need code examples. Since none have been provided, I'd suggest we search SO for "Azure Python error 137" You will find several questions and answers with suggestions on how others with your same error reduced their memory footprint when using the azure storage libraries.

Sign up to request clarification or add additional context in comments.

2 Comments

I provided a link to the code in the last comment in OP. Its all good now. I changed from boto3 put_object to upload_fileobj and setup a TransferConfig that included threading etc. The function screams now and no more code 137's.
Got it. Your other Q fixed you up. stackoverflow.com/a/64273426/2048857. Good to know. Glad you are running good now.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.