-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability in task spec to wait for a lock before proceeding #208
Comments
Small question, would it make sense to support a list of locks rather than a single lock? Could people want to acquire locks on different resources with different timeouts but still want the executing workflow to depend one or both of them? |
List of locks could potentially be dangerous and cause deadlock scenarios, in my opinion. Classic deadlock scenario is:
If locks are not obtained and released in the exact same order in all code paths, you risk the chance of a deadlock scenario. It's much safer to just have one single lock and ensure it is always released in the face of an exception or return from your code path (In this case a workflow success or failure). |
Fair enough, I was coming from a specific use case where I needed a lock for a group of servers and another lock for individual server within that group when I asked if it made sense to support a list of locks. If Orquesta would suffer from the same deadlock/livelock issues as OS threads, then I agree it's a dangerous feature to allow. |
This is a good point on deadlock. I think for the time being we will keep this simple. The engine should detect that a lock is already acquired and will not allow additional lock requests in subworkflow(s) since that is possible. |
There are use cases where users want to synchronize access to a resource (i.e. server) across multiple and different workflow executions. Currently, StackStorm offers concurrency policies to synchronize executions for one given workflow.
The following proposal allows specification of the lock requirement across different workflow definition so synchronization is possible against different workflow executions on the same resource(s). In the proposal below, a new
wait
attribute is introduced to the task spec. The wait attribute takes the name of the lock, which can be a unique name or name of the resource. The task will sleep/delay until the lock is acquired. On exit from the task scope, the lock will be released.An additional wait delay can be specified. If the lock is not acquired within the wait period, the task will abandon the wait and exit with failure. On failure, the task transition will be traversed as normal so that clean up or retry is possible.
The mechanism will require on external platform such as redis which is currently already being used for various use cases in StackStorm (required for concurrency policies and running complex branching workflows, etc.).
The text was updated successfully, but these errors were encountered: