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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0039601
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformmajorrandom2018-11-07 15:032018-11-13 10:49
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PriorityimmediateResolutionfixedFixed in Version3.0PR19Q1
StatusclosedFix in branchFixed in SCM revisione834e74a3c1a
ProjectionnoneETAnoneTarget Version
OSAnyDatabasePostgreSQLJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression levelProduction - Confirmed Stable
Regression date2016-08-10
Regression introduced in release3.0PR16Q4
Regression introduced by commithttps://code.openbravo.com/erp/devel/pi/rev/88ea14de1a84e176f457750118a6d4823588d7d2 [^]
Triggers an Emergency PackNo
Summary

0039601: can't execute DB updates after killing a connection

DescriptionWith 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 ReproduceIn 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
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 00396033.0PR18Q4 closedalostale can't update information after killing a connection 
depends on backport 00396043.0PR18Q3.3 closedalostale can't update information after killing a connection 
caused by defect 00334413.0PR16Q4 closedNaroaIriarte query to check if ad_context_info exists executed once per request 

-  Notes
(0107798)
hgbot (developer)
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 (developer)
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 (developer)
2018-11-08 11:09

Repository: erp/devel/pi
Changeset: f55cbe0219f90db361464237f1c296ab2b82aa76
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Nov 08 10:57:00 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/f55cbe0219f90db361464237f1c296ab2b82aa76 [^]

related with bug 39601: let it fail if ad_context info couldn't be created

---
M src-core/src/org/openbravo/database/SessionInfo.java
---
(0107801)
hgbot (developer)
2018-11-08 11:09

Repository: erp/devel/pi
Changeset: 847353facd72c92a1936a239c428ce4964633f55
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Nov 08 10:59:02 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/847353facd72c92a1936a239c428ce4964633f55 [^]

related with bug 39601: minor code cleanup

---
M src-core/src/org/openbravo/database/SessionInfo.java
---
(0107876)
caristu (developer)
2018-11-13 10:49

Code reviewed + tested OK.

- 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 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 View Revisions
2018-11-07 15:09 alostale Status new => scheduled
2018-11-07 15:10 alostale Steps to Reproduce Updated View Revisions
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


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker