Skip to content

Eternal Functions not working as expected in Function Runtime Version: 4 #138

@kanupriya15025

Description

@kanupriya15025

I was trying out the below example on my local machine with the following conf:
Core Tools Version: 4.0.5198 Commit hash: N/A (64-bit)
Function Runtime Version: 4.21.1.20667

https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-eternal-orchestrations?tabs=java#periodic-work-example

This is the tweaked version of the function I ran :

    @FunctionName("EternalOrchestrator")
    public void startWorkflowSchedule(@DurableOrchestrationTrigger(name = "runtimeState") TaskOrchestrationContext ctx) 
     {
        LOGGER.info("Doing something in the cleanup loop");

        ctx.createTimer(Duration.ofSeconds(60)).await();

        ctx.continueAsNew(null);
     }

I doesn't work anymore with the upgrade to Function Runtime Version 4.21. This is the error I get before the second time timer starts in the loop :

Executed 'Functions.EternalOrchestrator' (Failed, Id=3eff24fa-d8ad-492e-8d8d-ac730bcb0a40, Duration=40ms)
[2023-06-01T06:24:50.322Z] System.Private.CoreLib: Exception while executing function: Functions.EternalOrchestrator. System.Private.CoreLib: Result: Failure
[2023-06-01T06:24:50.322Z] Exception: IllegalStateException: The orchestrator has already completed
[2023-06-01T06:24:50.322Z] Stack: java.lang.IllegalStateException: The orchestrator has already completed
[2023-06-01T06:24:50.322Z]      at com.microsoft.durabletask.Helpers.throwIfOrchestratorComplete(Helpers.java:31)
[2023-06-01T06:24:50.322Z]      at com.microsoft.durabletask.TaskOrchestrationExecutor$ContextImplTask.completeInternal(TaskOrchestrationExecutor.java:724)
[2023-06-01T06:24:50.322Z]      at com.microsoft.durabletask.TaskOrchestrationExecutor$ContextImplTask.completeInternal(TaskOrchestrationExecutor.java:717)
[2023-06-01T06:24:50.322Z]      at com.microsoft.durabletask.TaskOrchestrationExecutor$ContextImplTask.complete(TaskOrchestrationExecutor.java:704)
[2023-06-01T06:24:50.323Z]      at com.microsoft.durabletask.TaskOrchestrationExecutor.execute(TaskOrchestrationExecutor.java:60)
[2023-06-01T06:24:50.323Z]      at com.microsoft.durabletask.OrchestrationRunner.loadAndRun(OrchestrationRunner.java:135)
[2023-06-01T06:24:50.323Z]      at com.microsoft.durabletask.OrchestrationRunner.loadAndRun(OrchestrationRunner.java:69)
[2023-06-01T06:24:50.323Z]      at com.microsoft.durabletask.OrchestrationRunner.loadAndRun(OrchestrationRunner.java:42)
[2023-06-01T06:24:50.324Z]      at com.microsoft.durabletask.azurefunctions.internal.middleware.OrchestrationMiddleware.invoke(OrchestrationMiddleware.java:33)
[2023-06-01T06:24:50.324Z]      at com.microsoft.azure.functions.worker.chain.InvocationChain.doNext(InvocationChain.java:21)
[2023-06-01T06:24:50.324Z]      at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:125)
[2023-06-01T06:24:50.324Z]      at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:34)
[2023-06-01T06:24:50.324Z]      at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10)
[2023-06-01T06:24:50.325Z]      at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:44)
[2023-06-01T06:24:50.325Z]      at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:94)
[2023-06-01T06:24:50.325Z]      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
[2023-06-01T06:24:50.325Z]      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[2023-06-01T06:24:50.326Z]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[2023-06-01T06:24:50.326Z]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[2023-06-01T06:24:50.326Z]      at java.base/java.lang.Thread.run(Thread.java:1589)

Metadata

Metadata

Assignees

Labels

need investigationNeed investigation from a maintainer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions