Azure functions Kudu w3wp.exe throws OutOfMemoryException

Preetham Gowda 5 Reputation points
2024-09-17T00:33:30.8133333+00:00

Hello All,

We have dedicated App Service plan which is running 9 Azure Functions and 2 web apps on P3V3 pricing tier and we currently have 1 instance with manual scaling setting.

When we check the memory analysis, the actual function consume less memory than the kudu.

We are seeing unusual memory usage spikes time to time in function[kudu]-usage(like 12GB) but the actual function uses very less memory(500MB).

Also we are noticing OutofMemory exceptions for Kudu w3wp.exe process (not the actual function). Not sure what is kudu doing and why there are so many out of memory exceptions in kudu process. We are not running any background processes

Any help is much appreciated

</Data></EventData></Event><Event><System><Provider Name="ASP.NET 4.0.30319.0"/><EventID>1325</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2024-09-09T16:23:26Z"/><EventRecordID>493682687</EventRecordID><Channel>Application</Channel><Computer>12EXAMPLEABC</Computer><Security/></System><EventData><Data>An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/695954313/ROOT

Process ID: 568

Exception: System.OutOfMemoryException

Message: Exception of type 'System.OutOfMemoryException' was thrown.

StackTrace: at System.Text.StringBuilder.ToString()

at System.Diagnostics.AsyncStreamReader.ReadBuffer(IAsyncResult ar)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.IO.Stream.ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(Task completingTask)

at System.Threading.Tasks.Task.FinishContinuations()

at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&amp; currentTaskSlot)

at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)

at System.Threading.ThreadPoolWorkQueue.Dispatch()</Data></EventData></Event><Event><System><Provider Name=".NET Runtime"/><EventID>1026</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2024-09-09T16:23:26Z"/><EventRecordID>493682750</EventRecordID><Channel>Application</Channel><Computer>12EXAMPLEABC</Computer><Security/></System><EventData><Data>Application: w3wp.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.OutOfMemoryException

at System.Text.StringBuilder.ToString()

at System.Diagnostics.AsyncStreamReader.ReadBuffer(System.IAsyncResult)

at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

at System.IO.Stream+ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(System.Threading.Tasks.Task)

at System.Threading.Tasks.Task.FinishContinuations()

at System.Threading.Tasks.Task.Finish(Boolean)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)

at System.Threading.Tasks.Task.ExecuteEntry(Boolean)

at System.Threading.ThreadPoolWorkQueue.Dispatch()

</Data></EventData></Event><Event><System><Provider Name="ASP.NET 4.0.30319.0"/><EventID>1325</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2024-09-09T17:14:02Z"/><EventRecordID>496718125</EventRecordID><Channel>Application</Channel><Computer>12EXAMPLEABC</Computer><Security/></System><EventData><Data>An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/695954313/ROOT

Process ID: 12464

Exception: System.OutOfMemoryException

Message: Exception of type 'System.OutOfMemoryException' was thrown.

StackTrace: at System.Text.StringBuilder.set_Length(Int32 value)

at System.Diagnostics.AsyncStreamReader.ReadBuffer(IAsyncResult ar)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.IO.Stream.ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(Task completingTask)

at System.Threading.Tasks.Task.FinishContinuations()

at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&amp; currentTaskSlot)

at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)

at System.Threading.ThreadPoolWorkQueue.Dispatch()</Data></EventData></Event><Event><System><Provider Name=".NET Runtime"/><EventID>1026</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2024-09-05T16:33:59Z"/><EventRecordID>112999109</EventRecordID><Channel>Application</Channel><Computer>12EXAMPLEABC</Computer><Security/></System><EventData><Data>Application: w3wp.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.OutOfMemoryException

at System.Text.StringBuilder.set_Length(Int32)

at System.Diagnostics.AsyncStreamReader.ReadBuffer(System.IAsyncResult)

at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

at System.IO.Stream+ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(System.Threading.Tasks.Task)

at System.Threading.Tasks.Task.FinishContinuations()

at System.Threading.Tasks.Task.Finish(Boolean)

at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)

at System.Threading.Tasks.Task.ExecuteEntry(Boolean)

at System.Threading.ThreadPoolWorkQueue.Dispatch()

</Data></EventData></Event><Event><System><Provider Name="ASP.NET 4.0.30319.0"/><EventID>1325</EventID><Level>1</Level><Task>0</Task><Keywords>Keywords</Keywords><TimeCreated SystemTime="2024-09-05T16:58:43Z"/><EventRecordID>114482625</EventRecordID><Channel>Application</Channel><Computer>12EXAMPLEABC</Computer><Security/></System><EventData><Data>An unhandled exception occurred and the process was terminated.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.