BPT OnReady Human Activity Lock

BPT OnReady Human Activity Lock

  

Hi

Someone already had problem related timeout in OnReady Human Activity callback?

In the start I have this simple flow with this SaveData Human Activity.


I want to update some information of a generic Request entity in OnReady action, like this.

In this point, I'm having OnReady timeout error

"Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."

In the the detaill error the problem happen exactly in this phase of the GetRequestForUpdate and UpdateRequest.

I also extract all this logic for another action, but the problem still happen.

The workaround was create a automatic activity before where in this activity I'm performing the same update operation. In this case it is working well, but I woldnt have another one activity just to do this.


Hi Tiago,

Could it be a locking problem, since you do a GetForUpdate?

Hi Tiago,

You have RequestId right? why you dont do a simple aggregate and update that record? As Killian said maybe GetForUpdate lock your transaction.

@Tiago

Do you really need to do that update when the Human Activity is opening? Can't it be done in the OnClose of the previous activity or after the user does something?

Hi 

Thanks for your help.

I tried changing the logic to use GetRequest by the Id instead of GetForUpdate and the problem still happing.

So It look like that the database transaction inside this OnReady logic was not been commited until the timeout happen, even I call all this logic operation inside a server logic, the problem still happen.

@João, the business need is to update a status information of this entity before the Activity is opened, it need to be updated really on the OnReady event. OnReady not mean when this activity is opening, right? 

Best regards

Tiago Vital

Tiago Bojikian da Costa Vital wrote:

Hi 

Thanks for your help.

I tried changing the logic to use GetRequest by the Id instead of GetForUpdate and the problem still happing.

So It look like that the database transaction inside this OnReady logic was not been commited until the timeout happen, even I call all this logic operation inside a server logic, the problem still happen.

@João, the business need is to update a status information of this entity before the Activity is opened, it need to be updated really on the OnReady event. OnReady not mean when this activity is opening, right? 

Best regards

Tiago Vital

Tiago, 


The table you want update, is the same table has the trigger? 


Try do a "committransaction" before process begin

Hi Fábio 

No, it is not starting after the create /update trigger.

Another important information. 

In the human activity web screens there is a parameter that receive the value from the human activity by the function getRequest(RequestId)user Id 

This is the same table that we are updating in the OnReady action.

Could it is locking the record ?

Best regards 

Tiago Vital 

Hi guys,

The problem was really related the input parameter used in the Human Activity using the function getEntityName(EntityId).attribute and inside the onReady this "EntityName" was being updated.

So, the conclusion is that this way (using getEntityName(EntityId).attribute) to query the table, occurs lock in the record.

As we need some information from this table and I can't pass a record as the input of the launch Process,Even so, I had to create the automatic activity just to query this record and I putted as the output of this activity the data I need.

Thanks everybody Who help with this issue.

Cheers

Tiago Vital

The another way to solve this is you just call the "CommitTransaction" before launch the BPT.

In this case, the most strange things is that the "CreateRequest" logic is another server action, then I expected that in the end of this action the transaction should be commited.

If I remove this "CommitTransaction" of my flow, the redirection to HomePage in the end spend more than 1 minute, I start have error in some count performed to TaskBox like this:

Look the duration of these counts.


If the BPT starts asynchronous, I don't know why the redirect is note performin after this.

Hi Tiago,


From the description of the LaunchProcess action, that should only happen if the OnReady of the activity starts before the redirection node is reached.

Have you tried to change your process to LaunchOn automatically when a Request record is created instead of launching it explicitly in your code?



Cheers,

Tiago.


Another thing - What type of update are you doing in the OnReady? If you're just setting a simple field in the Request entity, maybe you should use a SQL node with an UPDATE statement. DB Locks can easily escalate in some DB Servers. 

While this is not a solution to your problem, it should assure better performance.

Hi Tiago

I haven't tried start the process when the request record is created.

In some case, the request record can be created but we are not expecting to start the BPT. This is the reason to not start the BPT by the creation record trigger.

Inside the OnReady Human Activity action, We are updating a status attribute in this entity. We really want to do this in this part of the flow. The update is being performin by a specific action that has his itself transaction, not directly in the OnReady action.

Cheers

Tiago Vital

Ok, so in that scenario it is a good practice to execute the explicit commit before launching the process.

Regarding the update, If it does not require complex validations, you should use a SQL node and avoid the GetForUpdate.


Alright

Thanks for the advice