You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Giulio Speri - MpStyle Srl <gi...@mpstyle.it> on 2021/01/07 11:16:17 UTC

Error in storeOrder: duplicate entry for key primary

Hello everyone,

I hope you're doing good.

I am writing because I am facing a strange issue with our ecommerce ofbiz
installation for one of our customers.

In short, since yesterday, ofbiz fails in storing an order with the error:

Ran Event [java:org.ofbiz.order.shoppingcart.CheckOutEvents#createOrder]
> from [request], result is [error]
> 2021-01-07 10:40:28,490 |0.0.0.0-8009-exec-21 |RequestHandler
>    |E| Request processorder caused an error with the following message: Non
> completare l'ordine, il seguente è occorso:Creazione ordine fallita;
> contattare il servizio di assistenza clienti.



The ofbiz logs, shows also this more explicit error:

*Caused by: java.sql.SQLIntegrityConstraintViolationException:
(conn=261079) Duplicate entry 'LCT5793' for key 'PRIMARY'*

just after its attempt to store the OrderHeader GenericValue.

I know that the error message is auto-explanatory, but the strange thing is
that is appeared more or less suddenly, with no preliminar signals of any
kind.

Just to complete the picture, I add that no operation (both software or
hardware) has been done on application server and database server.

I already did a bit of investigation within the code that generates the
next order id and I saw that the next order id is calculated starting from
the field *lastOrderNumber *of the entity *PartyAcctgPreference *for the
main Company.

One thing that I noticed on this record is that the last order number is 1
behind the "real" last order id in the system.

I really cannot explain how this could be possible since that whole system
worked perfectly until one day ago.

Is it enough to restore the functionality to manually update the
lastOrderNumber field on the PartyAcctgEntity? Or is there more that needs
to be taken into the account?

Thanks in advance,

Giulio



-- 
Giulio Speri


*Mp Styl**e Srl*
via Antonio Meucci, 37
41019 Limidi di Soliera (MO)
T 059/684916
M 334/3779851

www.mpstyle.it

Re: Error in storeOrder: duplicate entry for key primary

Posted by Pritam Kute <pr...@hotwaxsystems.com>.
Hello Giulio,

Thanks for the updates. Glad to hear that you were able to track and
resolve the issue. We had faced the same issue in one of the custom
projects but later found that it was because of some customizations we did.

Kind Regards,
--
Pritam Kute


On Fri, Jan 8, 2021 at 2:18 PM Giulio Speri - MpStyle Srl <
giulio.speri@mpstyle.it> wrote:

> Hello Pritam,
>
> thank you for your answer.
>
> My answer to your three questions is "No, we didn't" to all of three, but
> after deeper investigations we find out that an unfortunate event
> (temporary down of the application server) occured while an order was in
> creation.
> We think that the down event could probably prevent the commit of the
> updated lastOrderCount on PartyAcctgPreference.
>
> Once I manually updated the mis-aligned field with the real last order id,
> the system was able to correctly register orders again.
>
> We're going to keep monitoring the system, but for now we can consider this
> issue as closed.
>
> Thank you for your help,
> Giulio
>
> Il giorno ven 8 gen 2021 alle ore 07:51 Pritam Kute <
> pritam.kute@hotwaxsystems.com> ha scritto:
>
> > Hello Giulio,
> >
> > This is really a strange issue. Can you answer the following questions to
> > get to know more about the issue?
> >
> > Have you made any customizations in the SequenceUtil class?
> > Is this issue happening for your first order in the system?
> > Have you checked if by mistake you have loaded some demo data into the
> > system?
> >
> > Kind Regards,
> > --
> > Pritam Kute
> >
> >
> > On Thu, Jan 7, 2021 at 4:47 PM Giulio Speri - MpStyle Srl <
> > giulio.speri@mpstyle.it> wrote:
> >
> > > Hello everyone,
> > >
> > > I hope you're doing good.
> > >
> > > I am writing because I am facing a strange issue with our ecommerce
> ofbiz
> > > installation for one of our customers.
> > >
> > > In short, since yesterday, ofbiz fails in storing an order with the
> > error:
> > >
> > > Ran Event
> [java:org.ofbiz.order.shoppingcart.CheckOutEvents#createOrder]
> > > > from [request], result is [error]
> > > > 2021-01-07 10:40:28,490 |0.0.0.0-8009-exec-21 |RequestHandler
> > > >    |E| Request processorder caused an error with the following
> message:
> > > Non
> > > > completare l'ordine, il seguente è occorso:Creazione ordine fallita;
> > > > contattare il servizio di assistenza clienti.
> > >
> > >
> > >
> > > The ofbiz logs, shows also this more explicit error:
> > >
> > > *Caused by: java.sql.SQLIntegrityConstraintViolationException:
> > > (conn=261079) Duplicate entry 'LCT5793' for key 'PRIMARY'*
> > >
> > > just after its attempt to store the OrderHeader GenericValue.
> > >
> > > I know that the error message is auto-explanatory, but the strange
> thing
> > is
> > > that is appeared more or less suddenly, with no preliminar signals of
> any
> > > kind.
> > >
> > > Just to complete the picture, I add that no operation (both software or
> > > hardware) has been done on application server and database server.
> > >
> > > I already did a bit of investigation within the code that generates the
> > > next order id and I saw that the next order id is calculated starting
> > from
> > > the field *lastOrderNumber *of the entity *PartyAcctgPreference *for
> the
> > > main Company.
> > >
> > > One thing that I noticed on this record is that the last order number
> is
> > 1
> > > behind the "real" last order id in the system.
> > >
> > > I really cannot explain how this could be possible since that whole
> > system
> > > worked perfectly until one day ago.
> > >
> > > Is it enough to restore the functionality to manually update the
> > > lastOrderNumber field on the PartyAcctgEntity? Or is there more that
> > needs
> > > to be taken into the account?
> > >
> > > Thanks in advance,
> > >
> > > Giulio
> > >
> > >
> > >
> > > --
> > > Giulio Speri
> > >
> > >
> > > *Mp Styl**e Srl*
> > > via Antonio Meucci, 37
> > > 41019 Limidi di Soliera (MO)
> > > T 059/684916
> > > M 334/3779851
> > >
> > > www.mpstyle.it
> > >
> >
>
>
> --
> Giulio Speri
>
>
> *Mp Styl**e Srl*
> via Antonio Meucci, 37
> 41019 Limidi di Soliera (MO)
> T 059/684916
> M 334/3779851
>
> www.mpstyle.it
>

Re: Error in storeOrder: duplicate entry for key primary

Posted by Giulio Speri - MpStyle Srl <gi...@mpstyle.it>.
Hello Pritam,

thank you for your answer.

My answer to your three questions is "No, we didn't" to all of three, but
after deeper investigations we find out that an unfortunate event
(temporary down of the application server) occured while an order was in
creation.
We think that the down event could probably prevent the commit of the
updated lastOrderCount on PartyAcctgPreference.

Once I manually updated the mis-aligned field with the real last order id,
the system was able to correctly register orders again.

We're going to keep monitoring the system, but for now we can consider this
issue as closed.

Thank you for your help,
Giulio

Il giorno ven 8 gen 2021 alle ore 07:51 Pritam Kute <
pritam.kute@hotwaxsystems.com> ha scritto:

> Hello Giulio,
>
> This is really a strange issue. Can you answer the following questions to
> get to know more about the issue?
>
> Have you made any customizations in the SequenceUtil class?
> Is this issue happening for your first order in the system?
> Have you checked if by mistake you have loaded some demo data into the
> system?
>
> Kind Regards,
> --
> Pritam Kute
>
>
> On Thu, Jan 7, 2021 at 4:47 PM Giulio Speri - MpStyle Srl <
> giulio.speri@mpstyle.it> wrote:
>
> > Hello everyone,
> >
> > I hope you're doing good.
> >
> > I am writing because I am facing a strange issue with our ecommerce ofbiz
> > installation for one of our customers.
> >
> > In short, since yesterday, ofbiz fails in storing an order with the
> error:
> >
> > Ran Event [java:org.ofbiz.order.shoppingcart.CheckOutEvents#createOrder]
> > > from [request], result is [error]
> > > 2021-01-07 10:40:28,490 |0.0.0.0-8009-exec-21 |RequestHandler
> > >    |E| Request processorder caused an error with the following message:
> > Non
> > > completare l'ordine, il seguente è occorso:Creazione ordine fallita;
> > > contattare il servizio di assistenza clienti.
> >
> >
> >
> > The ofbiz logs, shows also this more explicit error:
> >
> > *Caused by: java.sql.SQLIntegrityConstraintViolationException:
> > (conn=261079) Duplicate entry 'LCT5793' for key 'PRIMARY'*
> >
> > just after its attempt to store the OrderHeader GenericValue.
> >
> > I know that the error message is auto-explanatory, but the strange thing
> is
> > that is appeared more or less suddenly, with no preliminar signals of any
> > kind.
> >
> > Just to complete the picture, I add that no operation (both software or
> > hardware) has been done on application server and database server.
> >
> > I already did a bit of investigation within the code that generates the
> > next order id and I saw that the next order id is calculated starting
> from
> > the field *lastOrderNumber *of the entity *PartyAcctgPreference *for the
> > main Company.
> >
> > One thing that I noticed on this record is that the last order number is
> 1
> > behind the "real" last order id in the system.
> >
> > I really cannot explain how this could be possible since that whole
> system
> > worked perfectly until one day ago.
> >
> > Is it enough to restore the functionality to manually update the
> > lastOrderNumber field on the PartyAcctgEntity? Or is there more that
> needs
> > to be taken into the account?
> >
> > Thanks in advance,
> >
> > Giulio
> >
> >
> >
> > --
> > Giulio Speri
> >
> >
> > *Mp Styl**e Srl*
> > via Antonio Meucci, 37
> > 41019 Limidi di Soliera (MO)
> > T 059/684916
> > M 334/3779851
> >
> > www.mpstyle.it
> >
>


-- 
Giulio Speri


*Mp Styl**e Srl*
via Antonio Meucci, 37
41019 Limidi di Soliera (MO)
T 059/684916
M 334/3779851

www.mpstyle.it

Re: Error in storeOrder: duplicate entry for key primary

Posted by Pritam Kute <pr...@hotwaxsystems.com>.
Hello Giulio,

This is really a strange issue. Can you answer the following questions to
get to know more about the issue?

Have you made any customizations in the SequenceUtil class?
Is this issue happening for your first order in the system?
Have you checked if by mistake you have loaded some demo data into the
system?

Kind Regards,
--
Pritam Kute


On Thu, Jan 7, 2021 at 4:47 PM Giulio Speri - MpStyle Srl <
giulio.speri@mpstyle.it> wrote:

> Hello everyone,
>
> I hope you're doing good.
>
> I am writing because I am facing a strange issue with our ecommerce ofbiz
> installation for one of our customers.
>
> In short, since yesterday, ofbiz fails in storing an order with the error:
>
> Ran Event [java:org.ofbiz.order.shoppingcart.CheckOutEvents#createOrder]
> > from [request], result is [error]
> > 2021-01-07 10:40:28,490 |0.0.0.0-8009-exec-21 |RequestHandler
> >    |E| Request processorder caused an error with the following message:
> Non
> > completare l'ordine, il seguente è occorso:Creazione ordine fallita;
> > contattare il servizio di assistenza clienti.
>
>
>
> The ofbiz logs, shows also this more explicit error:
>
> *Caused by: java.sql.SQLIntegrityConstraintViolationException:
> (conn=261079) Duplicate entry 'LCT5793' for key 'PRIMARY'*
>
> just after its attempt to store the OrderHeader GenericValue.
>
> I know that the error message is auto-explanatory, but the strange thing is
> that is appeared more or less suddenly, with no preliminar signals of any
> kind.
>
> Just to complete the picture, I add that no operation (both software or
> hardware) has been done on application server and database server.
>
> I already did a bit of investigation within the code that generates the
> next order id and I saw that the next order id is calculated starting from
> the field *lastOrderNumber *of the entity *PartyAcctgPreference *for the
> main Company.
>
> One thing that I noticed on this record is that the last order number is 1
> behind the "real" last order id in the system.
>
> I really cannot explain how this could be possible since that whole system
> worked perfectly until one day ago.
>
> Is it enough to restore the functionality to manually update the
> lastOrderNumber field on the PartyAcctgEntity? Or is there more that needs
> to be taken into the account?
>
> Thanks in advance,
>
> Giulio
>
>
>
> --
> Giulio Speri
>
>
> *Mp Styl**e Srl*
> via Antonio Meucci, 37
> 41019 Limidi di Soliera (MO)
> T 059/684916
> M 334/3779851
>
> www.mpstyle.it
>