Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
workflow race condition
wailing
Hi,
I have a workflow whose flow goes like this:
Review Content
|
V
Check-In Staging
|
V
External Task to Create Edition and OpenDeploy by filelist
I'm experiencing this situation where race conditions are popping out in the external task when two or more workflow jobs are running at the same time e.g. iwnexted chucks the same edition no.
Does anybody here have any experience on how to resolve race conditions in workflows? Or to avoid such race conditions from occurring?
V grateful for any advice, TIA!
rgds,
Rika
Find more posts tagged with
Comments
Adam Stoller
Have your externaltask script attempt to get a "lock" before proceeding, if unable to do so, have it loop until it can, and make sure that the lock is removed at the end of the script.
If you're on Unix you can probably use the Fcntl Perl module (I'm assuming your externaltask script is written in Perl).
If you're on Windows, you may have to make your own home-grown solution since I don't think Windows supports fcntl (I cannot remember whether W2K fixed this).
Essentially you're trying to create a temporary file that shouldn't already exist. If it does already exist, loop with a sleep() call and try again). If it doesn't already exist, create it.
I suggest putting useful information within the lock file (jobid/taskid/owner, etc.) - and having your loop keep a counter - so that if it doesn't succeed in N tries (you define N), it sends email off to an administrator to check into a possible problem (a lock file being left behind).
--fish
(Interwoven Senior Technical Consultant)