cancel
Showing results for 
Search instead for 
Did you mean: 

Environmental Lock - Tech Issues

ChloeMacIntosh
Level 4
I have implemented an "Acquire Lock" stage in a process to prevent multiple VMs from checking pending items and populating the queue at the same time, and added a "Release Lock" stage once the queue is populated. I have tested this on 2 VMs, expecting the first VM to acquire the lock and the second to pause at the Acquire Lock stage until the lock is released. However, when ran in control room, both VMs continued after the Acquire Lock stage to check pending items and populate the queue - instead of the first VM acquiring the lock and the second pausing at this stage until the lock is released. Does anyone have any ideas on how to change this so it works effectively?
5 REPLIES 5

david.l.morris
Level 14
What timeout did you put in the Acquire Lock action's timeout input? For my explanation below, I'm going to assume you put timeout of zero. If you put a timeout of zero in Acquire Lock, then one of the sessions (one of the VMs) will get the lock and the other will not. This does not do anything but cause one of the sessions to 'own' a piece of text. They will both go forward. You need a decision stage after that to check this: [Lock]"""" For the session that acquired the lock, the answer will be True. For the other session, the answer will be False. You would then need to have an alternate path for the False side to skip over the next few steps or have it wait for a period of time or something. However, let's say you want both of them to do the same set of steps at the same time. That's when you would put a timeout on the Acquire Lock stage. Let's say you put a TimeSpan of 1 hour (Either --""0.1:0:0""-- or --MakeTimeSpan(0,1,0,0)--). The session that acquires the lock will move forward and the other session will stay on the Acquire Lock stage for up to 1 hour. If the first session releases the lock before 1 hour has passed, then the second session will get the lock and move forward. If the first session does not release the lock before 1 hour has passed, then the second session will move forward without getting the lock. So, basically, you almost always want a decision stage after Acquire Lock to determine the path to take.
Dave Morris 3Ci at Southern Company Atlanta, GA

Environment Locks - Acquire Lock Action - Timeout Parameter Issue
I've come across the situation where i wanted to release the lock automatically after few minutes. So I'm passing 5 minutes as time span for Timeout parameter while acquiring the lock, but its not working. Lock is not getting released after 5 minutes, its showing in the locked state. Would anybody have any insight into what may be causing this? We are currently running BP V6.4. Thanks in advance.



------------------------------
Sachin J
RPA Modeler
BNY Mellon Technology
Asia/Kolkata
------------------------------

The Timeout parameter for Acquire Lock is the max amount of time that the session will wait in order to acquire the lock. The only ways to release a lock are either (1) to use the action 'Release Lock', (2) the session ends which will cause the an automatic unlock of the environment lock, or (3) to manually unlock it in the System tab.

That Timeout parameter is the same as the maximum wait time in a Wait Stage when looking for an element, except that in the case of the Acquire Lock action, it doesn't throw an error if it doesn't get the lock in that amount of time. It just continues on the process flow and you need to use a decision stage to determine if the lock was acquired.

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Thank you, got it.

------------------------------
Sachin J
RPA Modeler
BNY Mellon Technology
Asia/Kolkata
------------------------------

JoakimEklund
Level 6
Hi Chloe,

If you could provide a screenshot of the Blue Prism steps and parameters of the "Acquire Lock" action it would make the trobuleshooting easier.
Based on your description it seems like the next stage after "Acquire Lock" leads to populating the queue, I recommend having a decision stage checking whether any Token was generated after running "Acquire Lock". If a token wasn't generated, add a retry loop with some wait time (perhaps using the "Sleep" action in "Utility - Environment") or use the input parameter in the "Acquire Lock".

/Joakim

------------------------------
Joakim Eklund
Senior RPA Developer
Swedbank AB
Europe/Stockholm
------------------------------