You are viewing limited content. For full access, please sign in.

Question

Question

Workflow Script Timeout

asked on April 2, 2015

I have an SDK script activity in Workflow 9.2 that locks a Records Series Folder (RSF), updates a value, and then unlocks it.  This has been working fine for 6+ months but I've recently had an issue where two separate workflows attempted to lock the same RSF at the exact same moment.  Neither was successful but both kept attempting to lock the record for 5+ days.  Neither script failed or timed out and thus both Workflows were stuck until I terminated one of them.  Scripts in Workflow have a timeout for disconnect (default to 2 minutes) but I do not see a timeout I can set if they are just running too long.  I realize it is probably unlikely for this to happen but it could cause a huge issue.  Is there a way to set a timeout on an actively working SDK script in Workflow (similar to the timeout for the query activities) or has anyone found another method to handle this? I was thinking maybe using the deadline activity maybe?

0 0

Replies

replied on April 2, 2015

I also, found the Simple Synchronization Sequence which looks perfect for this.  Anyone else used either of these methods or found a better way to handle this script issue?

0 0
replied on April 3, 2015

I was hoping someone knew a better way to set a script timeout in Workflow.  What I've ended up doing is put the script in a simple synchronization activity (to minimize the chance of it attempting to lock the same document) but am wondering if I also need to put it in a deadline so that if it runs over a couple of minutes that it fails over to the deadline branch.  Anyone have any thoughts on if that is necessary and if it did fail over to the deadline branch, would it actually kill the script that was stuck?

0 0
replied on April 3, 2015

The Syncrhonization sequence is your best bet for a  non-scripting solution to the problem, and was created for just such a purpose. 

There isn't an explicit timeout for scripts like you are asking for. The timer you mentioned handles the case of things like infinite loops or deadlocks where the script hasn't communicated via an API method in the past n minutes and depending on your server options, its usually only partially successful at stopping running code it doesn't have an entry point into. 

Deadlines should be able to cancel the waiting for the script to complete but I don't think they can always stop the script from running (same issue as above). 

Just curious, are you looping in your script or is it the retry mechanism that is retrying the scripts over and over?

 

 

 

0 0
replied on April 3, 2015

The script is not looping.  It is the entrylock portion that just keeps retrying. My code only has a few lines. It locks the document, updates a field value, saves the changes, and unlocks the document.  The problem is that another workflow is also attempting this same lock at the exact same time.  I've implemented the simple sync but this is a tough one to test.

0 0
replied on April 3, 2015

The script is not looping.  It is the entrylock portion that just keeps retrying. My code only has a few lines. It locks the document, updates a field value, saves the changes, and unlocks the document.  The problem is that another workflow is also attempting this same lock at the exact same time.  I've implemented the simple sync but this is a tough one to test.

replied on April 3, 2015

You are using the right tool to handle that job then. The sync sequence was designed to handle this case  and is able to respond much more quickly to the lock being freed then the current retry timers, though I'm a bit surprised they keep conflicting for so long.

 

 

0 0
replied on April 7, 2015

I was surprised too.  I've been using this script for over a year now with no issues but when it got stuck it caused a big issue that I want to ensure we never run into again.  Hopefully, this solves the problem and I never need to worry about this again. Thanks a ton for your help Ed.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.