Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0039362Openbravo ERPA. Platformpublic2018-09-27 14:522018-12-11 20:22
alostale 
alostale 
normalmajorrandom
closedfixed 
5
 
3.0PR19Q13.0PR19Q1 
AugustoMauch
Core
No
0039362: if ticket fails to be created due to no DB connections, no more tickets can be created from same terminal
As per design when a ticket creation fails at infrastructure level, the system will not allow to create any new ticket from the same terminal until the problem is fixed. Subsequent tickets from that are marked as error in "Data Import Entries".

The most common problem detected as infrastructural is running out of database connections. Although this situation is temporary and it gets automatically fixed when pressure in DB decreases, if there are tickets being processed in a moment where there are no connections to process but there is at least a connection to mark the ticket as error, it will be marked. Afterwards no tickets from that terminal will be created till errors are marked back as initial status.
Because it only happens under some race conditions, it cannot be easily reproduced. We can emulate these conditions as follows:

  1. Apply patch consume-all-connections.diff
  2. Set breakpoints to manually synchronize actions, in (line numbers from pi@fabe6e99f181):
       * About - line 60. Just when we exhausted the pool
       * ImportEntryProcessor - line 330. Start of doRunCycle
       * ImportEntryProcessor - line 441. Start of main catch block
  3. In WebPOS create a ticket
     -> It will stop in ImportEntryProcessor 330
  4. In backoffice open About popup
     -> It will consume all avaiable connections and stop in breakpoint
  5. Resume thread stopped in 3 keeping stopped the one in About
     -> It will fail and stop in ImportEntryProcessor 441
  6. Resume thread in About
     -> Connections are released
  7. Resume thread in ImportEntryProcessor
     -> The entry is marked as error
  8. Create more tickets from same terminal (no need of any breakpoint)
     -> Check: all these new tickets are set in error in Data Import Entries window

Note pool cat get exhausted because of reaching pool limit or by reaching limit of physical DB connections, in latter case exception is dbms specific.
The case of running out of connections should be handled as special:
- When it is detected, the ticket is left in Initial status instead of setting it in Error.
- If there are more tickets to be processed in the same cycle, none will be tried to be processed.
- Next cycle execution will pick all the tickets that were not processed and, if there are available connections, all will be processed.

In this way the problem will not be automatically fixed when instead of exposing to the end user.


No tags attached.
diff consume-all-connections.diff (1,564) 2018-09-27 15:24
https://issues.openbravo.com/file_download.php?file_id=12191&type=bug
? 39362.export (6,043) 2018-09-28 08:06
https://issues.openbravo.com/file_download.php?file_id=12193&type=bug
Issue History
2018-09-27 14:52alostaleNew Issue
2018-09-27 14:52alostaleAssigned To => alostale
2018-09-27 14:52alostaleModules => Core
2018-09-27 14:52alostaleTriggers an Emergency Pack => No
2018-09-27 14:57alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17697#r17697
2018-09-27 14:57alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17698#r17698
2018-09-27 15:24alostaleFile Added: consume-all-connections.diff
2018-09-27 15:57alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17703#r17703
2018-09-27 15:57alostaleProposed Solution updated
2018-09-28 08:06alostaleFile Added: 39362.export
2018-09-28 08:06alostaleNote Added: 0107059
2018-09-28 08:12alostaleStatusnew => scheduled
2018-09-28 08:16alostaleReview Assigned To => AugustoMauch
2018-09-28 08:17alostaleTarget Version => 3.0PR19Q1
2018-10-04 09:22hgbotCheckin
2018-10-04 09:22hgbotNote Added: 0107151
2018-10-04 09:22hgbotStatusscheduled => resolved
2018-10-04 09:22hgbotResolutionopen => fixed
2018-10-04 09:22hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d8c618c024703178e87d4b172b3f0fc34a6549f5 [^]
2018-10-04 09:22hgbotCheckin
2018-10-04 09:22hgbotNote Added: 0107152
2018-10-17 18:24AugustoMauchNote Added: 0107378
2018-10-17 18:24AugustoMauchStatusresolved => closed
2018-10-17 18:24AugustoMauchFixed in Version => 3.0PR19Q1
2018-12-11 20:22hudsonbotCheckin
2018-12-11 20:22hudsonbotNote Added: 0108418
2018-12-11 20:22hudsonbotCheckin
2018-12-11 20:22hudsonbotNote Added: 0108419

Notes
(0107059)
alostale   
2018-09-28 08:06   
attached proposed solution
(0107151)
hgbot   
2018-10-04 09:22   
Repository: erp/devel/pi
Changeset: d8c618c024703178e87d4b172b3f0fc34a6549f5
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Sep 28 08:03:08 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d8c618c024703178e87d4b172b3f0fc34a6549f5 [^]

fixed issue 39362: can't create tickets if one failed due to pool without conns

  After a ticket failed to be imported due to the pool is out of connections, no
  new tickets can be created from that terminal until all import entries are set
  again in Initial status.

  Now in this case instead of setting the import entry as Error preventing new
  tickets from the same terminal to be processed, it's kept in Initial status,
  in this way it will be tried to be processed in next cycle, not exposing the
  problem to users.

---
M modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/JdbcExternalConnectionPool.java
M src-core/src/org/openbravo/database/ExternalConnectionPool.java
M src/org/openbravo/service/importprocess/ImportEntryProcessor.java
---
(0107152)
hgbot   
2018-10-04 09:22   
Repository: erp/devel/pi
Changeset: ba9ef09516cf6e6bddb220691a55bdc720244463
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Oct 02 09:43:11 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/ba9ef09516cf6e6bddb220691a55bdc720244463 [^]

related to issue 39362: added test cases covering no DB conns detection

---
M src-test/src/org/openbravo/test/AllAntTaskTests.java
A src-test/src/org/openbravo/test/db/pool/PoolHasNoConnectionsDetection.java
---
(0107378)
AugustoMauch   
2018-10-17 18:24   
Code reviewed and verified
(0108418)
hudsonbot   
2018-12-11 20:22   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/470e3cd384c5 [^]
Maturity status: Test
(0108419)
hudsonbot   
2018-12-11 20:22   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/470e3cd384c5 [^]
Maturity status: Test