Deadlock Detected.Process XXX waits for ShareLock on transaction XXX blocked by process XXX

Description

Hi Ordoro Developers,
Recently, while transferring the order to Ordoro via the https://apiverson.ordoro.com/order link, there has been consistent issue with the Deadlock for some reason. We did not make any changes recently but this problem is coming almost daily now for one or two orders only. We can retry and it will pass the next transfer. The below is the error message from ordoro.The below are the timing that is occurring.

Date: Thu, 11 Jun 2020 01:43:10 GMT
Date: Thu, 11 Jun 2020 01:53:10 GMT
Date: Thu, 11 Jun 2020 02:38:10 GMT

ResponseBody: {“error_message”: "(psycopg2.extensions.TransactionRollbackError) deadlock detected\nDETAIL: Process 95826 waits for ShareLock on transaction 1578556413; blocked by process 2216.\nProcess 2216 waits for ShareLock on transaction 1578556414; blocked by process 95826.\nHINT: See server log for query details.\nCONTEXT: while locking tuple (2351578,47) in relation\“inventory_product\”\n ([file://%22inventory_product/%22/n](file://“inventory_product/%22/n)) [SQL: '\\n SELECT id\\n FROM inventory_product\\n WHERE company_id = %(company_id)s\\n AND id = %(product_id)s\\n FOR UPDATE\\n '] [parameters: {‘company_id’: 460159, ‘product_id’: 80383521}]”, “param”: null}”

The support from Ordoro requested us to send this message to the forum to resolve this issue.

Regards
Ryan Lee

Hi @Ryan,

Sorry to hear that you’re having some issues. The best course of action we can offer at this time is to continue to retry. If you are doing this manually, we would suggest that you update the integration to the API to retry in the code for those that are seeing this failure.

Hope this gets you further along,

Sophie

Hi Sophie,

Thanks for reaching out. Unfortunately we have hundreds of orders per day and it is currently automated to send. We would have to compare what is inside Ordoro and our internal system to see what is missing, cancel and re-trigger the request. This is both Timeconsuming and error prone if we miss one order.

I would like to point out that before June, this issue did not occur, so it could be something that has been updated in Ordoro recently. It is failing everyday few orders. Would you mind at least on your side to see what could have cause this ?

Regards
Ryan Lee

Hi,

Yes, we are continually working on performance improvements within the app, and acknowledge the error you are receiving.

How are the orders being sent to Ordoro? I’m assuming this is an API integration question, so if you are in control of the orders being sent to the API, you should be able to update the code to account for retries so that you do not have to check or compare items.

Hi Sophie,

It is via CPI( Cloud Platform Integration). yes. using API to send. However, it is triggered when system creates the warehouse request and task together. So we have to reject the warehouse request and then retrigger again manually for this issue.
Since it is a Push method from our ERP system, it not possible to retry.
Regards
Ryan Lee

Hi Sophie,
I also receive some error message as below, Database error while trying to update Product Information.
Do you have any idea what is the update about? What information does it require?

STRICT-TRANSPORT-SECURITY: max-age=63072000; includeSubDomains; preload
Server: nginx/1.15.3
X-API-REQUEST-ID: 71e8c1ee-755a-4db2-9ca3-4f601319a535
X-APIVERSON-REQUEST-ID: ba25b3ed-1fc0-4194-8f4f-b3ee1e6c8273
X-ORDORO-API-SERVER: i-05382ae0989bf2ad9 1.1114.0
X-ORDORO-HANDLED-BY: ip-172-31-30-88
X-SENTRY-ID: 354cbc677734478cb9963bb057b4f7c3
HTTPStatusCode = 500
ModelStepId = MessageFlow_2
ResponseBody = {“error_message”: “A database error occured while trying to update product information.”, “param”: null}
StepId = MessageFlow_2#1592349492130
Activities [
{Activity=logAdapterProcessing, StartTime=Tue Jun 16 23:18:12.130 UTC 2020}
{Activity=sap-util://restoreHeaders?allHeaders=true, StartTime=Tue Jun 16 23:18:12.132 UTC 2020, StopTime=Tue Jun 16 23:18:12.132 UTC 2020}
]

Regards
Ryan Lee

Hi Sophie,

The scenario seems to be like this. I have maybe 5 or more API calls to Ordoro having the same product in the line item but different shipping address. This 5 Api calls are about 0:01 second apart. Would it cause an issue in Ordoro? I can’t control the call to ordoro as it is all done by a Mass Data Job Run every few min. When I look at the failed orders, this is the most common scenario. If I trigger it manually, mostly it will pass to ordoro.

Regards
Ryan Lee

Hi Sophie

We are experiencing high volume of rejection from Ordoro. Is there any way Ordoro can resolve the deadlock issue?
Sending few orders of the same products via API at almost the same time will trigger this issue.

Regards
Ryan lee