Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0039601 | Openbravo ERP | A. Platform | public | 2018-11-07 15:03 | 2018-12-11 20:22 |
|
Reporter | alostale | |
Assigned To | alostale | |
Priority | immediate | Severity | major | Reproducibility | random |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR19Q1 | |
Merge Request Status | |
Review Assigned To | caristu |
OBNetwork customer | No |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | Production - Confirmed Stable |
Regression date | 2016-08-10 |
Regression introduced in release | 3.0PR16Q4 |
Regression introduced by commit | https://code.openbravo.com/erp/devel/pi/rev/88ea14de1a84e176f457750118a6d4823588d7d2 [^] |
Triggers an Emergency Pack | No |
|
Summary | 0039601: can't execute DB updates after killing a connection |
Description | With Audit trail active, killing DB connections can cause random failures while trying to update information.
Technically the problem is:
1. Pool keeps PooledConnections each of them associated with a physical DB connection
2. When one of those physical DB connections is killed and a PooledConnection is going to be used (borrowed from the pool), Tomcat transparently creates a new physical connection and associates it with the existing PooledConnection instance.
3. Openbravo, in order not to recreate ad_context_info temporary table on each borrow, does it when a new connection is created and marks it as already initialized. This flag is set in the PooledConnection, incorrectly assuming a PooledConnection instance is always tight to the same Connection instance
4. Because of 2nd step, a new uninitialized Connection is associated with an existing PooledConnection marked as initialized, so queries expecting the temporary table to be present will fail.
This situation remains until the connection is finally returned to the pool. |
Steps To Reproduce | In a Professional instance:
0. Configure DB pool to a fixed 5 connections:
db.pool.initialSize=5
db.pool.minIdle=5
db.pool.maxActive=5
1. As System Admin open Table window
2. Select any table and mark it as fully audited
3. Restart Tomcat
4. Kill the 5 connections that are in pool: in psql execute select pg_terminate_backend(pid), pid from pg_stat_activity where application_name ='openbravo';
5. Log in
6. Open Process Request window
7. Create a new record and save
-> Saving failed. ERROR: relation "ad_context_info" does not exist |
Proposed Solution | |
Additional Information | |
Tags | No tags attached. |
Relationships | depends on | backport | 0039603 | 3.0PR18Q4 | closed | alostale | can't update information after killing a connection | depends on | backport | 0039604 | 3.0PR18Q3.3 | closed | alostale | can't update information after killing a connection | caused by | defect | 0033441 | 3.0PR16Q4 | closed | NaroaIriarte | query to check if ad_context_info exists executed once per request |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2018-11-07 15:03 | alostale | New Issue | |
2018-11-07 15:03 | alostale | Assigned To | => alostale |
2018-11-07 15:03 | alostale | OBNetwork customer | => No |
2018-11-07 15:03 | alostale | Modules | => Core |
2018-11-07 15:03 | alostale | Triggers an Emergency Pack | => No |
2018-11-07 15:05 | alostale | Relationship added | caused by 0033441 |
2018-11-07 15:06 | alostale | Review Assigned To | => caristu |
2018-11-07 15:06 | alostale | Regression level | => Production - Confirmed Stable |
2018-11-07 15:06 | alostale | Regression introduced in release | => 3.0PR16Q4 |
2018-11-07 15:07 | alostale | Regression date | => 2016-08-10 |
2018-11-07 15:07 | alostale | Regression introduced by commit | => https://code.openbravo.com/erp/devel/pi/rev/88ea14de1a84e176f457750118a6d4823588d7d2 [^] |
2018-11-07 15:08 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=17903#r17903 |
2018-11-07 15:09 | alostale | Status | new => scheduled |
2018-11-07 15:10 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=17904#r17904 |
2018-11-07 16:46 | alostale | Summary | can't update information after killing a connection => can't execute DB updates after killing a connection |
2018-11-07 18:57 | rafademiguel | Issue Monitored: rafademiguel | |
2018-11-08 11:09 | hgbot | Checkin | |
2018-11-08 11:09 | hgbot | Note Added: 0107798 | |
2018-11-08 11:09 | hgbot | Status | scheduled => resolved |
2018-11-08 11:09 | hgbot | Resolution | open => fixed |
2018-11-08 11:09 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/e834e74a3c1ab469e8513de70348c59db1d2c18e [^] |
2018-11-08 11:09 | hgbot | Checkin | |
2018-11-08 11:09 | hgbot | Note Added: 0107799 | |
2018-11-08 11:09 | hgbot | Checkin | |
2018-11-08 11:09 | hgbot | Note Added: 0107800 | |
2018-11-08 11:09 | hgbot | Checkin | |
2018-11-08 11:09 | hgbot | Note Added: 0107801 | |
2018-11-13 10:49 | caristu | Note Added: 0107876 | |
2018-11-13 10:49 | caristu | Status | resolved => closed |
2018-11-13 10:49 | caristu | Fixed in Version | => 3.0PR19Q1 |
2018-12-11 20:22 | hudsonbot | Checkin | |
2018-12-11 20:22 | hudsonbot | Note Added: 0108455 | |
2018-12-11 20:22 | hudsonbot | Checkin | |
2018-12-11 20:22 | hudsonbot | Note Added: 0108456 | |
2018-12-11 20:22 | hudsonbot | Checkin | |
2018-12-11 20:22 | hudsonbot | Note Added: 0108457 | |
2018-12-11 20:22 | hudsonbot | Checkin | |
2018-12-11 20:22 | hudsonbot | Note Added: 0108458 | |
Notes |
|
(0107798)
|
hgbot
|
2018-11-08 11:09
|
|
Repository: erp/devel/pi
Changeset: e834e74a3c1ab469e8513de70348c59db1d2c18e
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Nov 08 10:19:51 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/e834e74a3c1ab469e8513de70348c59db1d2c18e [^]
fixed bug 39601: can't execute DB updates after killing a connection
Audit Trail infrastructure (ad_context_info in PG) is initialized each time a
new connection is created. We incorrectly assumed a PooledConnection is always
associated with a single Connection instance, which is not true in case Connection
gets corrupted or killed, in this case Tomcat pool transparently re-associates
a new connection with existent PooledConnection.
We are now caching in PooledConnection actual Connection to detect this case
so it can be initialized again.
---
M modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/ConnectionInitializerInterceptor.java
---
|
|
|
(0107799)
|
hgbot
|
2018-11-08 11:09
|
|
Repository: erp/devel/pi
Changeset: 2ef2c5233cab721eb5a786bfcd49bc054d05f59b
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Nov 08 10:47:32 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2ef2c5233cab721eb5a786bfcd49bc054d05f59b [^]
related with bug 39601: minor code cleanup
---
M modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/ConnectionInitializerInterceptor.java
---
|
|
|
(0107800)
|
hgbot
|
2018-11-08 11:09
|
|
|
|
(0107801)
|
hgbot
|
2018-11-08 11:09
|
|
|
|
|
Code reviewed + tested OK. |
|
|
|
|
|
|
|
|
|
|
|
|
|