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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0029258
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 09. Financial managementmajorsometimes2015-03-12 13:512016-06-24 22:11
ReporteralostaleView Statuspublic 
Assigned ToSandrahuguet 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision1c18bcb8922b
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toeduardo_Argal
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0029258: FIN_Utility.getDocumentNo method can return duplicates

DescriptionFIN_Utility.getDocumentNo method can return duplicates.

It is the same problem reported in 0025075. This fix [1] seems to have two problems:

1. It tries to acquire a lock in ad_sequence only in case docType.getDocumentSequence() is null. If it is not null, no lock is acquired being possible to get duplicates.
2. The lock when docType.getDocumentSequence() is null seems not to be done in database. Testing it it PG a select statement without "for update" clause is sent to DB. This, most probably, occurs due to a hibernate issue [2]

[1] https://code.openbravo.com/erp/devel/pi/rev/e884b5f2318b77d3cbd8765541d5a5b4b5ebbef2 [^]
[2] https://hibernate.atlassian.net/browse/HHH-5275 [^]
Steps To ReproduceIt is hard to reproduce in a real environment as concurrency in very specific conditions is required:
-Thread A starts transaction
-Thread A gets document number for a concrete document type
-Thread B starts transaction
-Thread B gets document number for the same document type A got it
  --> B got the same number than A

Attached DocumentNumberGeneration class with test cases emulating these conditions. It fails for the cases:
-twoDalCalls
-dalFirstThenPL
-plFirstThenDal

Proposed Solution-Is it required to have different implementations one in PL and another one in DAL?
-If both are required fix DAL:
  * Change current lock to prevent hibernate issue
  * Add lock for second case which currently is unattended

Attached export with proposed solution, pending to review with functional team.
TagsNo tags attached.
Attached Files? file icon DocumentNumberGeneration.java [^] (6,895 bytes) 2015-03-12 13:52
? file icon issue-29258.export [^] (15,390 bytes) 2015-03-12 15:20

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0025075 closededuardo_Argal FIN_Utility.getDocumentNo method can return the same documentno to same document and organization. 

-  Notes
(0087895)
hgbot (developer)
2016-06-24 13:10

Repository: erp/devel/pi
Changeset: 1c18bcb8922b1ed9cee90c9867ab5d9dfdb10358
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Jun 24 13:09:36 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/1c18bcb8922b1ed9cee90c9867ab5d9dfdb10358 [^]

Fixes Issue 29258. Fixes problem when locking a sequence number
to avoid duplicates. Now it locks the sequence number using
LockOptions.UPGRADE instead.

---
M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
A src-test/src/org/openbravo/advpaymentmngt/test/DocumentNumberGeneration.java
---
(0087896)
eduardo_Argal (developer)
2016-06-24 13:12

Reviewed and tested
(0087913)
hudsonbot (developer)
2016-06-24 22:11

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/cc0900cf80c9 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2015-03-12 13:51 alostale New Issue
2015-03-12 13:51 alostale Assigned To => Sandrahuguet
2015-03-12 13:51 alostale Modules => Core
2015-03-12 13:51 alostale Triggers an Emergency Pack => No
2015-03-12 13:52 alostale File Added: DocumentNumberGeneration.java
2015-03-12 13:57 alostale Steps to Reproduce Updated View Revisions
2015-03-12 13:58 alostale Relationship added related to 0025075
2015-03-12 14:00 alostale Proposed Solution updated
2015-03-12 15:19 alostale Proposed Solution updated
2015-03-12 15:20 alostale File Added: issue-29258.export
2016-01-19 05:00 yogaskarnik Issue Monitored: yogaskarnik
2016-06-24 13:10 hgbot Checkin
2016-06-24 13:10 hgbot Note Added: 0087895
2016-06-24 13:10 hgbot Status new => resolved
2016-06-24 13:10 hgbot Resolution open => fixed
2016-06-24 13:10 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1c18bcb8922b1ed9cee90c9867ab5d9dfdb10358 [^]
2016-06-24 13:12 eduardo_Argal Review Assigned To => eduardo_Argal
2016-06-24 13:12 eduardo_Argal Note Added: 0087896
2016-06-24 13:12 eduardo_Argal Status resolved => closed
2016-06-24 22:11 hudsonbot Checkin
2016-06-24 22:11 hudsonbot Note Added: 0087913


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker