Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Revisions: Issue #41604 All Revisions ] Back to Issue ]
Summary 0041604: Deadlocks in the Orderloader updating AD_Sequence using Synchronized Mode
Revision 2019-08-08 11:18 by aaroncalero
Steps To Reproduce Log in backend and configure the following:
*In Preference window:
  > Use Order Document Number for Related Docs = 'N'
  > Web POS Synchronized Mode = 'Y'
*In Business Partner window: configure a customer with Invoice Term = After Delivery.

Log in Web POS in terminal VBS-1:
Create a new Layaway, assign the edited customer and add a product.
Create a new ticket, assign the same customer, and add a product.
Go to Pay Open Tickets with the layaway and the draft ticket and add a payment for both documents. Do not complete the process yet.

Log in Web POS in terminal VBS1001:
Create a new ticket, assign the same customer, and add a product.
Click on the total amount button and add a payment. Do not complete the process yet.

In eclipse:
Go to the Orderloader.java and set up a breakpoint at the end of the saveRecord function, just before the "return successMessage(jsonorder);" statement.

In the VBS-1 terminal, click on Done. After a few seconds the breakpoint in the Orderloader will hit. Verify that the order being synchronized is the layaway (use the Expressions window to check the documentNo). At this point, the transaction will hold the lock of the payments sequence.

In the VBS1001 terminal, click on Done. The WebPOS will remain 'Processing Transaction' but the breakpoint in the Orderloader won't hit because the payment sequence is still held by the first transaction. However this second transaction now holds the lock for both the shipment and invoice sequences.

Continue the execution of the breakpoint in the first transaction/thread (to process the second ticket created in VBS-1). Since this second ticket needs to create a shipment and an invoice, it will try to get the lock of these sequences, which are held by the second transaction (which in turn is blocked waiting for the first transaction to finish, generating the deadlock[1])


[1] Error shown:
2019-08-08 10:32:14,579 [http-nio-8080-exec-9] ERROR org.openbravo.erpCommon.utility.DocumentNoData - SQL error in query: CALL AD_Sequence_DocType(?,?,?,?) :org.postgresql.util.PSQLException: ERROR: deadlock detected
  Detail: Process 9594 waits for ShareLock on transaction 3756869; blocked by process 4980.
Process 4980 waits for ShareLock on transaction 3756867; blocked by process 9594.
  Hint: See server log for query details.
  Where: while updating tuple (87,9) in relation "ad_sequence"
SQL statement "UPDATE AD_Sequence
      SET CurrentNext=CurrentNext + IncrementNo
    WHERE AD_Sequence_ID=v_Sequence_ID"
PL/pgSQL function ad_sequence_doctype(character varying,character varying,character) line 54 at SQL statement
Revision 2019-08-08 10:59 by aaroncalero
Steps To Reproduce Log in backend and configure the following:
*In Preference window:
  > Use Order Document Number for Related Docs = 'N'
  > Web POS Synchronized Mode = 'Y'
*In Business Partner window: configure a customer with Invoice Term = After Delivery.

Log in Web POS in terminal VBS-1:
Create a new Layaway, assign the edited customer and add a product.
Create a new ticket, assign the same customer, and add a product.
Go to Pay Open Tickets with the layaway and the draft ticket and add a payment for both documents. Do not complete the process yet.

Log in Web POS in terminal VBS1001:
Create a new ticket, assign the same customer, and add a product.
Click on the total amount button and add a payment. Do not complete the process yet.

In eclipse:
Go to the Orderloader.java and set up a breakpoint at the end of the saveRecord function, just before the "return successMessage(jsonorder);" statement.

In the VBS-1 terminal, click on Done. After a few seconds the breakpoint in the Orderloader will hit. Verify that the order being synchronized is the layaway (use the Expressions window to check the documentNo). At this point, the transaction will hold the lock of the payments sequence.

In the VBS1001 terminal, click on Done. The WebPOS will remain 'Processing Transaction' but the breakpoint in the Orderloader won't hit because the payment sequence is still held by the first transaction. However this second transaction now holds the lock for both the shipment and invoice sequences.

Continue the execution of the breakpoint in the first transaction/thread (to process the second ticket created in VBS-1). Since this second ticket needs to create a shipment and an invoice, it will try to get the lock of these sequences, which are held by the second transaction (which in turn is blocked waiting for the first transaction to finish, generating the deadlock)
Revision 2019-08-08 10:57 by aaroncalero
Steps To Reproduce Log in backend and configure the following:
*In Preference window:
  > Use Order Document Number for Related Docs = 'Y'
  > Web POS Synchronized Mode = 'Y'
*In Business Partner window: configure a customer with Invoice Term = After Delivery.

Log in Web POS in terminal VBS-1:
Create a new Layaway, assign the edited customer and add a product.
Create a new ticket, assign the same customer, and add a product.
Go to Pay Open Tickets with the layaway and the draft ticket and add a payment for both documents. Do not complete the process yet.

Log in Web POS in terminal VBS1001:
Create a new ticket, assign the same customer, and add a product.
Click on the total amount button and add a payment. Do not complete the process yet.

In eclipse:
Go to the Orderloader.java and set up a breakpoint at the end of the saveRecord function, just before the "return successMessage(jsonorder);" statement.

In the VBS-1 terminal, click on Done. After a few seconds the breakpoint in the Orderloader will hit. Verify that the order being synchronized is the layaway (use the Expressions window to check the documentNo). At this point, the transaction will hold the lock of the payments sequence.

In the VBS1001 terminal, click on Done. The WebPOS will remain 'Processing Transaction' but the breakpoint in the Orderloader won't hit because the payment sequence is still held by the first transaction. However this second transaction now holds the lock for both the shipment and invoice sequences.

Continue the execution of the breakpoint in the first transaction/thread (to process the second ticket created in VBS-1). Since this second ticket needs to create a shipment and an invoice, it will try to get the lock of these sequences, which are held by the second transaction (which in turn is blocked waiting for the first transaction to finish, generating the deadlock)


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker