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

View Issue DetailsJump to Notes ] Issue History ] Print ]
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

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(

               at org.hibernate.internal.ExceptionConverterImpl.convert(

               at org.hibernate.internal.ExceptionConverterImpl.convert(

               at org.hibernate.internal.SessionImpl.doFlush(

               at org.hibernate.internal.SessionImpl.flush(

               at org.openbravo.dal.service.OBDal.flush(

               at org.openbravo.idl.initial_data_load.stockjob_0_1.StockJob.tFileInputDelimited_1Process(

               at org.openbravo.idl.initial_data_load.stockjob_0_1.StockJob.runJobInTOS(

               at org.openbravo.idl.initial_data_load.stockjob_0_1.StockJob.runJob(

               at org.openbravo.idl.proc.StockProcess.runJob(

               at org.openbravo.idl.proc.IdlServiceETL.executeImport(

               at org.openbravo.idl.proc.IdlService.executeProcess(

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

               at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(

               at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(

               at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(

               at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(

               at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.addToBatch(

               at org.hibernate.persister.entity.AbstractEntityPersister.insert(

               at org.hibernate.persister.entity.AbstractEntityPersister.insert(

               at org.hibernate.action.internal.EntityInsertAction.execute(

               at org.hibernate.engine.spi.ActionQueue.executeActions(

               at org.hibernate.engine.spi.ActionQueue.executeActions(

               at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(

               at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(

               at org.hibernate.internal.SessionImpl.doFlush(

               ... 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(

               at org.postgresql.core.v3.QueryExecutorImpl.processResults(

               at org.postgresql.core.v3.QueryExecutorImpl.execute(

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
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.
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.
hgbot (developer)
2021-03-10 17:01

Merge Request created: [^]
hgbot (developer)
2021-03-11 10:00

Merge request merged: [^]
hgbot (developer)
2021-03-11 10:00

Directly closing issue as related merge request is already approved.

Repository: [^]
Changeset: e3f11ef65a06ba4395f316b6d81d55323fd1ecfe
Author: Mark <>
Date: 2021-03-10T09:04:12-03:00
URL: [^]

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/

- 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