-
Notifications
You must be signed in to change notification settings - Fork 64
Description
π Describe the bug
I am seeing an odd case in one of my production functions where every now and then the function will timeout and the worker restarted. Specifically this is always the same activity which is simply an activity that connects to Azure Service Bus to send a message to a queue. All other activities in the function do not show this behaviour.
I've tried to reproduce this timeout outside of an Azure Function (e.g. is it an SDK issue?) but I have been unable to.
From what I can see the task at some point gets destroyed:
[2025-08-13T12:16:44.057Z] Task was destroyed but it is pending!
[2025-08-13T12:16:44.057Z] task: <ContextEnabledTask pending name='Task-1285' coro=<Dispatcher._dispatch_grpc_request() done, defined at /opt/homebrew/Cellar/azure-functions-core-tools@4/4.1.1/workers/python/3.12/OSX/Arm64/azure_functions_worker/dispatcher.py:287> wait_for=<Future pending cb=[ContextEnabledTask.task_wakeup()]>>
and then subsequently this causes a timeout after the set time:
[2025-08-13T12:17:44.046Z] Timeout value of 00:01:00 exceeded by function 'Functions.publish_event' (Id: '98d8ea26-9f19-420e-b1d0-3ef47760b640'). Initiating cancellation.
[2025-08-13T12:17:44.099Z] Executed 'Functions.publish_event' (Failed, Id=98d8ea26-9f19-420e-b1d0-3ef47760b640, Duration=60066ms)
[2025-08-13T12:17:44.099Z] Microsoft.Azure.WebJobs.Host: Timeout value of 00:01:00 was exceeded by function: Functions.publish_event.
[2025-08-13T12:17:46.110Z] A function timeout has occurred. Restarting worker process executing invocationId '98d8ea26-9f19-420e-b1d0-3ef47760b640'.
[2025-08-13T12:17:46.557Z] Worker process started and initialized.
[2025-08-13T12:17:56.592Z] Restart of language worker process(es) completed.
And just to repeat I see this behaviour only with this activity (which I've essentially copied in my example below).
π€ Expected behavior
I would expect the task here to not get destroyed and the activity to not timeout.
β Steps to reproduce
I have managed to reproduce the issue locally, see my repo here: https://github.com/ajstewart/azure-durable-function-timeout-example
Follow the instructions in the readme.
I am running on macOS 15.5, Python 3.12.
I also see this on our production deployment which is running on our K8s cluster, using the Python 3.12 image.
The logs I've pasted above come from my local tests.
β‘If deployed to Azure
N/A