Azure Functions not executing function randomly

Son Nguyen 20 Reputation points
2025-02-20T12:33:53.4633333+00:00

On February 18, 2025, at 11:30 PM UTC, Azure Data Factory that call Azure Function in pipeline encountered a 503 error: "The service is unavailable."
User's image

After investigating the logs from the traces table in Application Insights, I noticed that the function ExcelOutCheckDoc was not executed. I also confirmed that under normal operation, there would be a log entry showing "executing ...." and Spring boot started, but this time, no such log appeared.
Normal operation log:
User's image

This time log:
User's image

My environment information

  • Function App plan: Y1
  • Operating System: Windows
  • Runtime version: 4.1037.0.23521
  • Java 17
  • Spring boot

Can someone help me identify the root cause?
Thank for all your helps.

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

Answer accepted by question author
  1. Roger Davies 75 Reputation points
    2025-02-25T16:01:55.79+00:00

    HI All,

    Just in case this is related, we experienced the same thing. On the 18th of February 2025 (actually sometime shortly after 17:55pm GMT a FunctionApp that had been running happily for almost 2 years suddenly went offline (internal server error 500). We have not been able to get it to service requests since,.

    However, this one is on an S1 Premium tier, and has "Always On" was already enabled (as suggested in this thread). We've been able to show that (1) the 2 worker processes are running fine (2) The methods expected in the app are detected (3) no requests reach the the functionapp (nothing is logged anywhere, either in the logstream, insights or diagnostics)

    It's because no incoming requests are ever 'heard' by the FunctionApp (all requests, including those with invalid keys give 500 error before they get as far as your function) - hence why your ExcelOutCheckDoc logs nothing, because the request never reaches it. It may be worth checking your "Diagnose and Solve Problems" -> "Availability and Performace" section of the FunctionApp as it may help you confirm it's the same scenario.

    This issue lies with Azures infrastructure, you can prove this because if you try creating a new deployment slot (without code) you will get "Internal Server Error" across the Azure blades. In the end we abandoned that FunctionApp, redeploying to a new one which worked fine with the same code and configuration etc.

    I have seen this before a few times - and this does tend to happen more with (Y1) tier FunctionApps, especially if Managed Identity (RBAC) access is being used (and you're using the "AzureWebJobsStorage__accountName" environment config key) or if it's a resource created a couple of years ago


1 additional answer

Sort by: Most helpful
  1. Anonymous
    2025-02-25T13:35:55.0533333+00:00

    Hello @Son Nguyen,

    As per this MS blog,

    The basic function apps require the cold start to start the function execution.

    This might be the reason for such behavior. If you are using basic plans, you need to ensure the function is always warm. To do that, you can make use of a timer trigger function which makes the function in warm state always.

    or you can make use of the Always on option in Function App which does the same.

    enter image description here

    Alternatively, you can try the below pipeline design to do the same from ADF pipeline.

    
     - Set variable activity and set a value as 0 in flag variable
    
     - Until activity - Give condition as @equals(variables('flag'),1)
    
    	 - Function app activity
    
    	 - Set variable activity - On the success of the Function app activity, set the flag variable value as 1.
    
    

    For the first time when the function app is not warm, the first function app call makes it in warm state, but the activity will get failed. Next, the until activity will re-run the same activity as the flag value remains the same and now as the function app is already warm state, the activity will get succeeded, and the flag value will be changed as 1. Now, the Until activity will be stopped.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment


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.