1

I am getting System.OutOfMemoryException exception for Blob Trigger Azure Function. When I am executing locally it is working fine.

enter image description here

Blog Trigger Azure Function:

public static class ProcessEvent
    {
        [FunctionName(nameof(ProcessEvent))]
        public static async Task Run([BlobTrigger(BlobStorageContainer.Name + "/{name}",
            Connection = "AzureWebJobsStorage")]
            Stream eventBlob, string name,
            [Inject] ILoggingService loggingService,
            [Inject] IEventProcessorService eventProcessor,
            [Inject] IBlobClient blobClient)
        {
            var logger = new Logger(loggingService);
            try
            {
                logger.Info($"Starting blob job tracker for file name {name}",
                    nameof(ProcessEvent));

                var eventContent = eventBlob.ReadAsString();

                var result = await eventProcessor.HandleProcessor(eventContent, logger);

                if (result)
                {
                    await blobClient.DeleteBlobAsync(BlobStorageContainer.Name, name);
                    logger.Info($"Blob deleted successfully file name: {name}");
                }
                else
                {
                    logger.Warning($"Unable to process blob job for file with name: {name}");
                }
            }
            catch (Exception ex)
            {
                logger.Error($"Unable to process blob job for file with name: {name}", ex,
                    nameof(ProcessEvent));
            }
        }
    }

My App Service Plan:

enter image description here

5
  • How big is the blobfile? Commented Aug 5, 2020 at 6:26
  • Usual size is between 4-5kb, but in some requests it can be 500-800kb Commented Aug 5, 2020 at 6:28
  • how many other functions are defined and running within the function app? how much overall concurrency is occurring per instance? Commented Aug 5, 2020 at 6:32
  • we have total 14 azure functions in this app Commented Aug 5, 2020 at 6:33
  • 1
    So then its likely that they together consume all the memory and you either have to scale up the plan or scale out the functions. Commented Aug 5, 2020 at 6:35

1 Answer 1

1

You can diagnose the memory usage in portal->your function app->Diagnose and solve problem->Memory Analysis->View Full Report. enter image description here

It shows the overall percent physical memory usage per instance over the last 24 hours.

https://learn.microsoft.com/en-us/azure/app-service/overview-diagnostics#health-checkup-graphs

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.