Closed bucc5062 closed 1 year ago
@bucc5062 thanks for informing pls share the all repro steps possible reason could be that the environment is running out of resources, such as memory or CPU, and is shutting down functions to free up resources. You may also want to monitor the resource usage of your function to see if it's exceeding any limits that might trigger the environment to shut it down.
let me dig a little deeper on this issue. We are an company that sells products on ecommerce platforms including Amazon. As we scale our business the amazon SPAPI order processing is hitting throttling issues and there is a need to look at a different approach.
One such is using Amazon's notification queue (sqs queue) to subscribe to notifications (ORDER_CHANGE_STATUS) and hold them in the queue. We then have a Azure function that uses an SqSQueue Trigger that when triggered by change norification receives the message and then on the correct status, processes the order into a service bus to be consumed by a local program.
Each one of these steps works fine, but the concern is the function. This is not a complicated or CPU intensive function so it is tough to consider it is running out of "resources", but how can I check? Insights? Alerts? I get no message or warning that some limit has been reached.
What I dso see is that the function will run for a period of time, then just stop. it will seem to be in a "pause" state because it will start again. The issues is that order notifications continue during this "pause" and that just builds up the backlog in thr queue so eventually the function stops, and waits.
this is not a scalable solution and one I will abandon if it cannot be understood or resolved.
So, what metrics should be looked at to understand why the function just stops arbitrarily.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
If you are not the original author (bucc5062) and believe this issue is not stale, please comment with /bot not-stale
and I will not close it.
you can check with below options Review Logs: Reviewing logs generated by your function can also help you identify issues. Azure provides several logging options, including log streaming and log analytics, which allow you to query and analyze your function logs.
Monitor Resource Utilization: It's important to monitor resource utilization to ensure that your function has the necessary resources to execute properly. You can use Azure Monitor to track resource utilization, including CPU, memory, and disk usage.
Check Function Limits: Azure functions have limits on execution time, concurrency, and other factors. You should check if your function is reaching any of these limits, which could cause it to stop arbitrarily.
Check Dependencies: If your function depends on external services, such as the Amazon notification queue, it's important to ensure that these services are available and functioning properly. You can monitor the health of these services using the appropriate tools and dashboards.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
If you are not the original author (bucc5062) and believe this issue is not stale, please comment with /bot not-stale
and I will not close it.
I have set up a consumption function that is triggered by an AWS notification queue. It is very simple an only consumes up to 10 notifications every 10 secs and if caught up, just checks until there is a new notification in the AWS simple sqsqueue. Once started the function runs well, but within a period of time, @ an hour the function automatically stopped by...something? I showed the output below. I don't understand what triggers the function to stop, but when it does the Amazon notifications start to backup. Is it a setting or something else?
2023-04-17T20:21:24Z [Information] Executed 'AMZSqsQueue' (Succeeded, Id=c9551064-7729-4921-a445-dfdbfb046c57, Duration=56ms) 2023-04-17T20:21:51Z [Verbose] Hosting stopping 2023-04-17T20:21:51Z [Verbose] Stopping file watchers. 2023-04-17T20:21:51Z [Verbose] Waiting for RpcFunctionInvocationDispatcher to shutdown 2023-04-17T20:21:51Z [Verbose] Draining invocations from language worker channel timed out. Shutting down 'RpcFunctionInvocationDispatcher' 2023-04-17T20:21:51Z [Information] Stopping JobHost 2023-04-17T20:21:51Z [Verbose] Stopping ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Information] Stopping the listener 'Azure.Functions.Extensions.SQS.SqsQueueTriggerListener' for function 'AMZSqsQueue' 2023-04-17T20:21:51Z [Information] Stopped the listener 'Azure.Functions.Extensions.SQS.SqsQueueTriggerListener' for function 'AMZSqsQueue' 2023-04-17T20:21:51Z [Information] Job host stopped 2023-04-17T20:21:51Z [Verbose] Stopped ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Verbose] Hosting stopped 2023-04-17T20:21:51Z [Verbose] Disposing ScriptHost. 2023-04-17T20:21:51Z [Verbose] Disposing ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Verbose] Disposing FunctionDispatcher 2023-04-17T20:21:51Z [Verbose] Disposed ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Verbose] Disposing ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Verbose] Disposed ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Verbose] Host instance '8bfbc692a14cf39b58034de04762ae8c' released lock lease. 2023-04-17T20:21:51Z [Verbose] Disposing ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'. 2023-04-17T20:21:51Z [Verbose] Disposed ScriptHost instance '720942b0-e1e5-460b-ad12-3b9e11a7ed59'.