Azure function - not being started

Michael 26 Reputation points
2020-07-11T19:24:37.193+00:00

Hi all -

I have a web service running that puts emails to be sent into a set of SQL tables and a separate piece of code running as an Azure function that deals with using SendGrid to push them out to the world. Said function runs on a Cron schedule once per minute and is running on my App Service Plan rather than on the consumption way of doing things.
It's run quite happily for a month but a couple of days back it randomly stopped running. There's no real evidence of why, but it wasn't being started any more. It wasn't running and crashing or anything like that. Precisely nothing has changed, it has not been re-deployed or anything.
I've gone to the portal, where it showed as 'Running', clicked the restart button and now it's quite happy again. It ticks along once a minute, logs to my database that it ran, everything I'd expect.

I'm looking for two pieces of advice ideally:

  1. Am I wrong in understanding that the whole point of these functions is that they don't crash, per se. If this tries to run and fails it will log to my database, but it was the fact that it just stopped getting started once per minute that threw me.
  2. If it is simply no longer running is there a way I can get an alert or some sort of notification to at least see this? I don't want to have to write another function that checks the logs to make sure this one is running! I've managed to configure something in Alerts real quickly that sends me something if the memory usage falls below a level at which point it clearly couldn't be running, but that seems a little daft....

Bonus question three. Is there a better way of doing this? Some other sort of queuing system within Azure that might be better suited?

Thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,398 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Christian Witschel 11 Reputation points
    2020-07-11T19:43:04.373+00:00

    It can happen that a function just hangs for whatever reason in between being called, but not getting into execution (rare, but shit happens).

    I would advice to wrap the function into a logic app that triggers on schedule (the trigger is called
    "Recurrence").

    Inside the logic app you can call the function and specify detailed timeout and retry settings .

    Additionally you can specify parallel following actions that run depending if the function was called successfull, failed or timed out.

    This should help you reach a more stable and reliable operation and handle all kind of abnormal situations.

    1 person found this answer helpful.
    0 comments No comments