Share via

Function Optimized Container Apps shutdowns during activity function running.

Shigeru Nakagaki 205 Reputation points
2025-08-29T07:23:00.98+00:00

Hi.

recently I faced a weird issue.

I triggered Container Apps by three HTTP requests.

When there is no retry by exception, everything are ok.

But when some exceptions were happened in activity function which invoked with context.call_activity_with_retry() method, Container Apps shut down without waiting for the retrying activity function to finish.

( shut down means zero replica.)

The last log before shut down is

MS_DURABLE_FUNCTION_EVENTS_LOGS
{
    "ProviderName":"DurableTask-AzureStorage",
    "TaskName":"OrchestrationServiceStats",
    "EventId":112,
    "EventTimestamp":"2025-08-29T07:03:09.1348287Z",
    "Pid":9,
    "Tid":39,
    "Level":4,
    "ExtensionGUID":"5eb34c26-4482-456b-a885-80e6c4d318b9",
    "Account":"xxx",
    "TaskHub":"xxx",
    "StorageRequests":107,
    "MessagesSent":4,
    "MessagesRead":4,
    "MessagesUpdated":10,
    "TableEntitiesWritten":42,
    "TableEntitiesRead":43,
    "PendingOrchestrators":0,
    "PendingOrchestratorMessages":0,
    "ActiveOrchestrators":0,
    "ActiveActivities":2,
    "AppName":"xxx",
    "ExtensionVersion":"2.2.0.221989"
}

ActiveActivities is two, but Container Apps shut down.
( ActiveOrchestrators is zero, why?)

What do you think could be causing this issue?

thanks

Azure Container Apps
Azure Container Apps

An Azure service that provides a general-purpose, serverless container platform.


Answer accepted by question author

Praveen Kumar Gudipudi 2,290 Reputation points Microsoft External Staff Moderator
2025-09-19T13:31:28.9933333+00:00

Hello Shigeru Nakagaki,

You are correct—this behavior can seem counter-intuitive. In Durable Functions, the scale controller monitors only the orchestrator load and does not consider activity execution. Therefore, even if activities are still running, the application may be treated as idle and scaled down if no orchestrator is active. This is the intended platform behavior, not a bug.

Your workaround is effective: increasing the cooldownPeriod or setting a minimum replica will prevent the container from shutting down while activities are being retried. Alternatively, using the Premium plan fully resolves this, as orchestrations are always maintained.

Please accept as answer and do a Thumbs-up to upvote this response if you are satisfied with the community help. Your upvote will be beneficial for the community users facing similar issues.

 User's image

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

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.