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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0045493
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Modules] Initial data loadmajorsometimes2020-11-24 10:502021-03-11 10:00
Reportersebastien_lironView Statuspublic 
Assigned Tomarkmm82 
PriorityimmediateResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version2.50
OSLinux 64 bitDatabasePostgreSQLJava version7.x
OS VersionOpenbravo Appliance 14.04Database version9.3.xAnt version1.9.x
Product Version2.50SCM revision 
Regression date
Regression introduced by commit
Regression levelProduction - Confirmed Stable
Review Assigned To
Regression introduced in release
Summary

0045493: IDL for inventory sometimes crash with coul not execute batch

DescriptionWith data file of 700 elements we had some issues using the idl stock.
At some point the process will crash with this stack :

Exception in component tJavaRow_3

javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute batch

               at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)

               at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)

               at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)

               at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1490)

               at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1470)

               at org.openbravo.dal.service.OBDal.flush(OBDal.java:265)

               at org.openbravo.idl.initial_data_load.stockjob_0_1.StockJob.tFileInputDelimited_1Process(StockJob.java:10289)

               at org.openbravo.idl.initial_data_load.stockjob_0_1.StockJob.runJobInTOS(StockJob.java:10683)

               at org.openbravo.idl.initial_data_load.stockjob_0_1.StockJob.runJob(StockJob.java:10613)

               at org.openbravo.idl.proc.StockProcess.runJob(StockProcess.java:51)

               at org.openbravo.idl.proc.IdlServiceETL.executeImport(IdlServiceETL.java:20)

               at org.openbravo.idl.proc.IdlService.executeProcess(IdlService.java:106)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute batch

               at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112)

               at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)

               at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)

               at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:129)

               at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.addToBatch(BatchingBatch.java:89)

               at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3175)

               at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3690)

               at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90)

               at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)

               at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:478)

               at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356)

               at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)

               at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1484)

               ... 53 more

Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into M_InventoryLine (AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy, M_Inventory_ID, M_Locator_ID, M_Product_ID, Line, QtyBook, QtyCount, C_UOM_ID, QuantityOrderBook, M_InventoryLine_ID) values ('255610F4EA224E279210315249611061', '2041C2B394754A26A23F4A2034872BF9', 'Y', '2020-11-16 12:10:21.779+01'::timestamp, '5CA2699596C24B4F96AE045E8E62C019', '2020-11-16 12:10:21.779+01'::timestamp, '5CA2699596C24B4F96AE045E8E62C019', '8AFF7BB6406244808710BF07CEB52861', '5439F164C8F14FEC8CF5C449EAA7ED7C', '1638480A6ED045E9910B3253D6F35786', 10, '0', '10000', '100', '0', '364FF4B9A03543B48DBD341349DBBD14') was aborted: ERROR: insert or update on table "m_inventoryline" violates foreign key constraint "m_inventoryline_m_inventory"

  Detail: Key (m_inventory_id)=(8AFF7BB6406244808710BF07CEB52861) is not present in table "m_inventory". Call getNextException to see other errors in the batch.

               at org.postgresql.jdbc.BatchResultHandler.handleError(BatchResultHandler.java:145)

               at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2179)

               at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:479)

Steps To Reproduceuse big files ( 1000 elements ) on stock import shoud trigger this error
Proposed SolutionI have added a diff with some code that seems to fix the issue ( I also added some logs ... ) and this patch is currenlty used in the Prod env with no more issues.

TagsNo tags attached.
Attached Filespatch file icon importStock.patch [^] (2,101 bytes) 2020-11-24 10:50 [Show Content]
csv file icon 20201005importSTK+(1).csv [^] (111,260 bytes) 2021-03-10 13:12

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0126296)
vmromanos (manager)
2021-02-23 10:11

NOTE: IDL is a deprecated module.

Quick fixes in general are OK (as it looks like the case for this issue), but no big effort will be invested in deprecated modules in general.
(0126586)
markmm82 (developer)
2021-03-10 13:13

Test Plan:
Import the attached CSV file and notice process ends successfully and any error is shown in logs.
(0126589)
hgbot (developer)
2021-03-10 17:01

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/328 [^]
(0126623)
hgbot (developer)
2021-03-11 10:00

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/328 [^]
(0126624)
hgbot (developer)
2021-03-11 10:00

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: e3f11ef65a06ba4395f316b6d81d55323fd1ecfe
Author: Mark <markmm82@gmail.com>
Date: 2021-03-10T09:04:12-03:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/e3f11ef65a06ba4395f316b6d81d55323fd1ecfe [^]

Fixes BUG-45493: Flush inventory to persist in database and avoid error:
Key (m_inventory_id)=(<INVENTORY_ID>) is not present in table "m_inventory".

---
M src/org/openbravo/materialmgmt/InventoryCountProcess.java
---

- Issue History
Date Modified Username Field Change
2020-11-24 10:50 sebastien_liron New Issue
2020-11-24 10:50 sebastien_liron Assigned To => Retail
2020-11-24 10:50 sebastien_liron File Added: importStock.patch
2020-11-24 10:50 sebastien_liron Regression level => Production - Confirmed Stable
2021-02-23 10:09 vmromanos Assigned To Retail => Triage Finance
2021-02-23 10:09 vmromanos Severity critical => major
2021-02-23 10:11 vmromanos Status new => scheduled
2021-02-23 10:11 vmromanos Note Added: 0126296
2021-02-23 10:11 vmromanos Assigned To Triage Finance => markmm82
2021-03-10 13:12 markmm82 File Added: 20201005importSTK+(1).csv
2021-03-10 13:13 markmm82 Note Added: 0126586
2021-03-10 17:01 hgbot Note Added: 0126589
2021-03-11 10:00 hgbot Resolution open => fixed
2021-03-11 10:00 hgbot Status scheduled => closed
2021-03-11 10:00 hgbot Note Added: 0126623
2021-03-11 10:00 hgbot Fixed in Version => PR21Q2
2021-03-11 10:00 hgbot Note Added: 0126624


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker