Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] A. Platformmajorrandom2018-11-07 15:032018-11-13 10:47
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PriorityimmediateResolutionfixedFixed in Version3.0PR18Q3.3
StatusclosedFix in branchFixed in SCM revisiona456297ffb38
ProjectionnoneETAnoneTarget Version3.0PR18Q3.3
OSAnyDatabasePostgreSQLJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
Regression levelProduction - Confirmed Stable
Regression date2016-08-10
Regression introduced in release3.0PR16Q4
Regression introduced by commit [^]
Triggers an Emergency PackNo

0039604: can't update information 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:
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 Position:
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0039601 closedalostale can't execute DB updates after killing a connection 

-  Notes
caristu (developer)
2018-11-13 10:39

Repository: erp/backports/3.0PR18Q3.3
Changeset: a456297ffb38ecfa584a54518d251cc3da9cda12
Author: Asier Lostalé <asier.lostale <at>>
Date: Thu Nov 08 10:19:51 2018 +0100
URL: [^] [^]

fixed bug 39603: 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/
caristu (developer)
2018-11-13 10:47

Code reviewed + tested OK.

- Issue History
Date Modified Username Field Change
2018-11-07 15:09 alostale Type defect => backport
2018-11-07 15:09 alostale Target Version => 3.0PR18Q3.3
2018-11-13 10:39 caristu Note Added: 0107873
2018-11-13 10:46 caristu Status scheduled => resolved
2018-11-13 10:46 caristu Fixed in Version => 3.0PR18Q3.3
2018-11-13 10:46 caristu Fixed in SCM revision => a456297ffb38ecfa584a54518d251cc3da9cda12
2018-11-13 10:46 caristu Resolution open => fixed
2018-11-13 10:47 caristu Fixed in SCM revision a456297ffb38ecfa584a54518d251cc3da9cda12 => [^]
2018-11-13 10:47 caristu Note Added: 0107875
2018-11-13 10:47 caristu Status resolved => closed

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker