Openbravo Issue Tracking System - Retail Modules | ||||||||||||
View Issue Details | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
0041604 | Retail Modules | Web POS | public | 2019-08-08 10:57 | 2019-09-12 11:21 | |||||||
Reporter | aaroncalero | |||||||||||
Assigned To | ranjith_qualiantech_com | |||||||||||
Priority | normal | Severity | major | Reproducibility | sometimes | |||||||
Status | closed | Resolution | fixed | |||||||||
Platform | OS | 5 | OS Version | |||||||||
Product Version | ||||||||||||
Target Version | Fixed in Version | RR19Q4 | ||||||||||
Merge Request Status | ||||||||||||
Review Assigned To | marvintm | |||||||||||
OBNetwork customer | Gold | |||||||||||
Support ticket | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0041604: Deadlocks in the Orderloader updating AD_Sequence using Synchronized Mode | |||||||||||
Description | When the "Use Order Document Number for Related Docs" is not configured, the Orderloader needs to generate sequences for shipments and invoices. When using Synchronized mode, orders are processed as soon as they are sent from WebPOS (there are no import entry queues) and because of this several orders from the same store can be processed in parallel. If two different transactions need to take the sequence locks in different order (see steps to reproduce) deadlocks can be generated | |||||||||||
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 | |||||||||||
Proposed Solution | Changing the Orderloader to hold the locks of all sequences (even if they are not updated) should make sure that there are no locks. The second transaction will need to wait until the first transaction has finished completely. | |||||||||||
Additional Information | ||||||||||||
Tags | No tags attached. | |||||||||||
Relationships |
| |||||||||||
Attached Files | ![]() https://issues.openbravo.com/file_download.php?file_id=13280&type=bug | |||||||||||
Issue History | ||||||||||||
Date Modified | Username | Field | Change | |||||||||
2019-08-08 10:57 | aaroncalero | New Issue | ||||||||||
2019-08-08 10:57 | aaroncalero | Assigned To | => Retail | |||||||||
2019-08-08 10:57 | aaroncalero | OBNetwork customer | => Gold | |||||||||
2019-08-08 10:57 | aaroncalero | Resolution time | => 1566424800 | |||||||||
2019-08-08 10:57 | aaroncalero | Triggers an Emergency Pack | => No | |||||||||
2019-08-08 10:59 | aaroncalero | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=19279#r19279 | |||||||||
2019-08-08 11:12 | aaroncalero | Proposed Solution updated | ||||||||||
2019-08-08 11:18 | aaroncalero | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=19280#r19280 | |||||||||
2019-08-13 14:49 | ranjith_qualiantech_com | Assigned To | Retail => ranjith_qualiantech_com | |||||||||
2019-08-13 14:49 | ranjith_qualiantech_com | Status | new => scheduled | |||||||||
2019-08-14 08:42 | ranjith_qualiantech_com | File Added: issue41604 source posterminal.patch | ||||||||||
2019-08-22 08:34 | ranjith_qualiantech_com | File Deleted: issue41604 source posterminal.patch | ||||||||||
2019-08-22 08:35 | ranjith_qualiantech_com | File Added: issue 41604 source posterminal.patch | ||||||||||
2019-08-23 04:57 | hgbot | Checkin | ||||||||||
2019-08-23 04:57 | hgbot | Note Added: 0114240 | ||||||||||
2019-08-23 04:57 | hgbot | Status | scheduled => resolved | |||||||||
2019-08-23 04:57 | hgbot | Resolution | open => fixed | |||||||||
2019-08-23 04:57 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/079f14931c5f1c9056ea1a5d1dcceff89dc9d43b [^] | |||||||||
2019-08-23 05:37 | hgbot | Checkin | ||||||||||
2019-08-23 05:37 | hgbot | Note Added: 0114243 | ||||||||||
2019-08-28 10:09 | ranjith_qualiantech_com | File Deleted: issue 41604 source posterminal.patch | ||||||||||
2019-08-28 14:43 | marvintm | Review Assigned To | => marvintm | |||||||||
2019-08-28 14:43 | marvintm | Status | resolved => closed | |||||||||
2019-08-28 14:44 | marvintm | Fixed in Version | => RR19Q4 | |||||||||
2019-09-02 16:00 | marvintm | Note Added: 0114364 | ||||||||||
2019-09-02 16:00 | marvintm | Status | closed => new | |||||||||
2019-09-02 16:00 | marvintm | Resolution | fixed => open | |||||||||
2019-09-02 16:00 | marvintm | Fixed in Version | RR19Q4 => | |||||||||
2019-09-04 07:45 | ranjith_qualiantech_com | File Added: issue 41604 source posterminal.patch | ||||||||||
2019-09-04 15:10 | ranjith_qualiantech_com | Status | new => scheduled | |||||||||
2019-09-10 08:16 | hgbot | Checkin | ||||||||||
2019-09-10 08:16 | hgbot | Note Added: 0114474 | ||||||||||
2019-09-10 08:16 | hgbot | Status | scheduled => resolved | |||||||||
2019-09-10 08:16 | hgbot | Resolution | open => fixed | |||||||||
2019-09-10 08:16 | hgbot | Fixed in SCM revision | http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/079f14931c5f1c9056ea1a5d1dcceff89dc9d43b [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/cdfdf0ba632b5c519c85e66fe186f44c9a401e78 [^] | |||||||||
2019-09-12 11:21 | marvintm | Status | resolved => closed | |||||||||
2019-09-12 11:21 | marvintm | Fixed in Version | => RR19Q4 | |||||||||
2019-11-06 08:17 | ranjith_qualiantech_com | Relationship added | causes 0042195 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|