Openbravo Issue Tracking System - Modules
View Issue Details
0026372ModulesService Contract Managementpublic2014-04-25 06:262014-05-30 12:17
sjkumar 
vmromanos 
highmajorrandom
closedfixed 
5
 
 
vmromanos
0026372: Randomly getting the error - ava.lang.Exception: Tx is not active
Getting this error randomly. Not sure what is causing this. Notice that mostly this comes whenever some process needs to be run to process the data.

I have seen this error message coming when doing the following
- Click on the Compute usage button on the service contract window
- Submitting the subscription main billing process
I cannot produce this all the time. It comes and goes. I am attaching the log from the $CATALINA_HOME/logs/Openbravo.log. See these logs from the bottom up.
No tags attached.
log Tx_error.log (45,414) 2014-04-25 06:26
https://issues.openbravo.com/file_download.php?file_id=6883&type=bug
7z openbravo.7z (143,288) 2014-05-08 06:34
https://issues.openbravo.com/file_download.php?file_id=6908&type=bug
doc Tx Error-TimeZone Bug 18837473 .doc (427,520) 2014-05-28 00:24
https://issues.openbravo.com/file_download.php?file_id=6955&type=bug
Issue History
2014-04-25 06:26sjkumarNew Issue
2014-04-25 06:26sjkumarAssigned To => vmromanos
2014-04-25 06:26sjkumarFile Added: Tx_error.log
2014-05-08 06:34sjkumarNote Added: 0067013
2014-05-08 06:34sjkumarFile Added: openbravo.7z
2014-05-22 16:16hgbotCheckin
2014-05-22 16:16hgbotNote Added: 0067371
2014-05-28 00:18sjkumarNote Added: 0067501
2014-05-28 00:18sjkumarNote Edited: 0067501bug_revision_view_page.php?bugnote_id=0067501#r5892
2014-05-28 00:24sjkumarFile Added: Tx Error-TimeZone Bug 18837473 .doc
2014-05-28 00:24sjkumarNote Edited: 0067501bug_revision_view_page.php?bugnote_id=0067501#r5893
2014-05-28 14:03vmromanosStatusnew => scheduled
2014-05-28 14:03vmromanosfix_in_branch => pi
2014-05-28 16:42vmromanosNote Added: 0067536
2014-05-28 16:47hgbotCheckin
2014-05-28 16:47hgbotNote Added: 0067537
2014-05-30 11:41hgbotCheckin
2014-05-30 11:41hgbotNote Added: 0067612
2014-05-30 11:41hgbotStatusscheduled => resolved
2014-05-30 11:41hgbotResolutionopen => fixed
2014-05-30 11:41hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.contract.services/rev/c83660a340db9f837c369fb07a2784153ebe9855 [^]
2014-05-30 12:17vmromanosReview Assigned To => vmromanos
2014-05-30 12:17vmromanosStatusresolved => closed

Notes
(0067013)
sjkumar   
2014-05-08 06:34   
Uploading log file (named = openbravo.7z) and screenshot for the usage computation for the issue related to this error. It is coming up in the Compute Usage button.
(0067371)
hgbot   
2014-05-22 16:16   
Repository: erp/pmods/org.openbravo.contract.services
Changeset: 5e40d141660b2d14b79b141c0d808ba146c104a8
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Thu May 22 16:16:01 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.contract.services/rev/5e40d141660b2d14b79b141c0d808ba146c104a8 [^]

Issue 26372: Catch Exception (instead of OBException) to ensure transaction sessions and rollback are properly managed

---
M src/org/openbravo/contract/services/process/computation/Computation.java
---
(0067501)
sjkumar   
2014-05-28 00:18   
(edited on: 2014-05-28 00:24)
Issue with different Time Zones in SPM | Reason for ?Tx is not active? error


1) While displaying a date type column in openbravo/SPM UI at IST timing zone, It is advancing the time stamp by 12 and half hours.
For example in database : one of a row in Usage table, has a Usage Starting Date as 05-27-2014 10:11:12.

but when I see the same date in SPM UI from IST zone place, It is coming as 05-27-2014 22:41:12 which is 12 and half hours ahead from database showed time stamp value

and when we see the same data from Mexico time zone, It is coming as 05-27-2014 12:11:12 which is two hours ahead from the database showed time stamp.

 
Because it stored as 05-01-2014 00:01:00 and validations have been passed. The below is the screenshot of it.

See detail attached - Tx Error-TimeZone Bug 18837473 .doc

(0067536)
vmromanos   
2014-05-28 16:42   
Hi Sanjay,

The root cause under the Tx not active is when an EntityPersistenceEventObserver raises an exception in the middle of the computation (not directly related to the timezone issue but with any exception).

When an EntityPersistenceEventObserver raises an exception, it automatically deactivate the transaction (Tx), so the computation can't catch the exception and this ugly message about Tx is not active is shown.

In this kind of scenarios, the system should be able to catch the exception thrown by the EntityPersistenceEventObserver and log it to the user. We are working on it and we will fix it very soon.




On the other hand, the behaviour you're reporting about date and timezone is the expected one. Let me explain how it works:

Openbravo stores the dates (day, month, year, hour, minutes, seconds, milliseconds) without timezone information. So if you directly query the database, you will see a date without the timezone information.

Instead of storing the timezone information, Openbravo stores all the dates transformed to the server's timezone (Oracle and Tomcat timezone, which must be the same in both); in your case it is probably PST. That means that when you query the database, the dates you see are referenced to PST timezone in your case. Example if you see 12:00 in the database it means 12:00 in PST.

When the UI loads a date from the backend, the system automatically transforms it to the client's (web browser) timezone. It means that, if the server and the browser are in different timezones, you will see that the date displayed into the UI is different from the date you can see if you directly query the database. Example if you see 12:00 in the database, which means 12:00 in PST, it may be displayed (for example) at 21:00 in CEST timezone.


As a summary:
* Dates directly read in database are referenced to the server's timezone
* Dates loaded into the UI are automatically transformed by Openbravo from the server's timezone to the client's timezone.
* Obviously, if different clients in different timezone see the same date record loaded from the database, they will see it as different dates (with the correspondent offset between the client and server timezone). However, the absolute date (referenced to the common server's timezone) will be the same, and it's the one stored into the database.


Important: If you manually load dates into the database (through CSV, using SQL INSERT/UPDATE, or any other way outside of the UI), you must do it always in the server's timezone, to ensure all the dates reference to the same timezone.
Right now you're not taking this into account, and it's the reason why you get this problem each time the system updates a subscribed service line (computation process, manual update by the user, etc.). There is a validation run into an EntityPersistenceEventObserver that verifies the subscribed service lines fit into the subscription start date - end date range.
(0067537)
hgbot   
2014-05-28 16:47   
Repository: erp/pmods/org.openbravo.contract.services
Changeset: faa4ad43c4c7292abbd6112596de658d3250669d
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Wed May 28 16:47:42 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.contract.services/rev/faa4ad43c4c7292abbd6112596de658d3250669d [^]

Issue 26372: ConsumeExpiredCommitment is able to manage EntityPersistenceEventObserver exceptions

Two sessions are opened at the same time: one for the ScrollableResults that contains the IPMs and Contracts Ids, and another one to manage each transaction

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M src/org/openbravo/contract/services/process/computation/expirecommitment/ConsumeExpiredCommitment.java
M src/org/openbravo/contract/services/process/computation/expirecommitment/ConsumeExpiredCommitmentDao.java
---
(0067612)
hgbot   
2014-05-30 11:41   
Repository: erp/pmods/org.openbravo.contract.services
Changeset: c83660a340db9f837c369fb07a2784153ebe9855
Author: Naiara Martinez <naiara.martinez <at> openbravo.com>
Date: Thu May 29 12:10:25 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.contract.services/rev/c83660a340db9f837c369fb07a2784153ebe9855 [^]

Fixed issue 26372: Fix tx is not active

---
M src/org/openbravo/contract/services/process/computation/Computation.java
M src/org/openbravo/contract/services/process/computation/ComputationDao.java
---