Comments (9)
@kaibocai I'm just now looking at the code you linked to, and I think you're correct about what the problem is. However, I disagree about the solution. There's nothing the extension can do to fix this - it merely persists the actions provided to it by the SDK. Rather, the problem in my opinion is that the SDK implementation is incorrect - we should not be blocking the orchestration like we are in the line you pointed to. The createTimer
method needs to be reimplemented in a way that is non-blocking.
from durabletask-java.
I think the issue comes from here
We explicitly await
the internal timer to complete. So when customer have a timer larger than 3 days they will have an internal timer we set for them, and the code is waiting on this timer to complete first. In this case, all the external events are buffered in queue because the internal timer is not completed so no further action is taken on those events. This also explain why when timer smaller than 3 days we don't see this issue.
We may need to find another way to resolve issue rasied at #114
from durabletask-java.
@kanupriya15025 We just released SDK v1.4.0, which has the fix for this issue. You can find it here Central Repository: com/microsoft/durabletask-azure-functions/1.4.0 (apache.org) Thank you
from durabletask-java.
I have a feeling that this is related to this change :
https://github.com/kamperiadis/durabletask-java/blob/5b0c54de018c62f1fbb6746ef10c6731073c4148/client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcWorker.java#L26
from durabletask-java.
Adding @kamperiadis for awareness.
from durabletask-java.
Thank you @kanupriya15025 for reporting this issue. Can you please clarify for me what you meant by "the event is read and then discarded." Just making sure that I understand the issue at hand - so you expected the "Patch received before start of schedule." to be shown since the patchEvent completed before the timer but you only saw the log when the timer was less than 3 days. Am I understanding it correctly?
from durabletask-java.
From my own testing, this seems to be happening because the orchestration does not finish starting before the external event is triggered. I was able to reproduce this issue when the timer had relatively large values since that's when I notice the orchestration taking longer to start. However, when I tested with a timer of 7 days, I still got the expected behavior, so I do not think this is related to the changes in #122 (i.e. 3 days did not consistently become the constraint for me). When testing with larger numbers (e.g. 10, 15), I was able to reproduce the issue more consistently.
from durabletask-java.
Hi @kanupriya15025! I was unable to reproduce this issue by following these steps:
- Make an API call to start the orchestration
- Wait for the orchestration to start
- Trigger the external event before the timer was up
- See the "winner is the external event" message in the logs
This is the sample code I am running
Endpoint that will trigger the orchestration:
@FunctionName("StartOrchestration")
public HttpResponseMessage startOrchestration(
@HttpTrigger(name = "req",
methods = {HttpMethod.GET, HttpMethod.POST},
authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage<Optional<String>> request,
@DurableClientInput(name = "durableContext") final DurableClientContext durableContext,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request");
final DurableTaskClient client = durableContext.getClient();
final String instanceId = client.scheduleNewOrchestrationInstance("WaitForExternalEvent");
return durableContext.createCheckStatusResponse(request, instanceId);
}
Orchestration logic similar to what you have described:
Task<Something> event = ctx.waitForExternalEvent("Approval", Something.class);
Task<?> timer = ctx.createTimer(Duration.ofDays(7));
Task<?> winner = ctx.anyOf(event, timer).await();
if (winner == event) {
response = event.await();
if (!ctx.getIsReplaying()) {
context.getLogger().info("winner is the external event");
ctx.continueAsNew(response);
return;
}
}
else {
context.getLogger().info("winner is the timer");
}
External event logic:
durableContext.getClient().raiseEvent(instanceId, "Approval", object);
Can you please let me know if these are not the right steps to reproduce the issue? Thank you.
from durabletask-java.
In this case, I don't think there is a workaround on SDK side, seems we need to update the DF extension accordingly.
@cgillum , @davidmrdavid do you have some better ideas? Thanks.
from durabletask-java.
Related Issues (20)
- Bug: Durable Task language SDK was implemented incorrectly, or that the destination language worker is not sending the function result back to the host HOT 4
- Support for function chaining in Java SDK HOT 3
- Azure Durable Function Secret Key changes every time I run durable function on local HOT 6
- Orchestrator functions failing if not returning anything HOT 9
- Deserialize problem on LocalDate HOT 1
- scheduleNewOrchestrationInstance function doesn't throw an error if instanceId already exists HOT 8
- Increase 4MB of gRPC limited in Azure Durable Function for Java HOT 2
- Eternal Functions not working as expected in Function Runtime Version: 4 HOT 5
- Getting io.grpc.StatusRuntimeException: UNKNOWN when calling durableClient.waitForInstanceCompletion HOT 7
- Getting io.grpc.StatusRuntimeException: UNKNOWN: unimplemented HOT 3
- Unable to suspend an orchestrator instance with functions runtime version 4.21.1.1 HOT 2
- Automatic retry not working with Fan-out Fan-in pattern HOT 2
- Orchestrator Function on Suspend and Resume if it already has an activity running HOT 2
- Durable Task Client Wait for Instance Completion Failure - UNKOWN HOT 1
- Add async API via Project Reactor HOT 5
- Add functionality to restrict number of parallel runs for a workflow HOT 2
- Ability to get partial output data in GET /instances/{instanceId} API HOT 8
- Incorrect retry count returned in case of Activity Function HOT 4
- Error querying Instance Table from function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from durabletask-java.