[TYPO3-commerce] Duplicated orders in database!!!
Morten Olesen
mo at idefa.dk
Wed Mar 10 15:25:32 CET 2010
Hi Bert (again),
Seems I was a little too quick to reply and jumped the gun, the problem
of 1 order having multiple order numbers is due to server load and
impatient users refreshing on the last step where the order is created.
The creation of an order is not a transaction either, so it's possible (
even easy given enough load on the server ) to have multiple attempts
to create the order succeed.
Normally the order is created so fast that it's not a problem, all
subsequent requests will result in no extra orders ( since the session
info, basket, etc have been converted from a paid basket to an order )
Hope this helps.
Morten Olesen wrote:
> Hi Bert,
>
> you should _really_ write you own order number generator,
> "com_ordernumber" is a working example at best.
>
> Your duplicate orders is due to it using a file ( in /tmp/domainname if
> memory serves ) rapid access will give you the "bankers problem";
>
> file [ 1000 ]
>
> Thread A: read file ( 1000 )
> Thread B: read file ( 1000 )
> Thread A: increment order number ( 1001 ) and write
> Thread B: increment order number ( 1001 ) and write
>
> file [ 1001 ]
>
> To solve it you need to make sure that the order generator is ACID, the
> easiest way is to make a ordernr table with auto increment on the key.
>
>
>
> /Morten
>
> Bert Hiddink [BENDOO e-work solutions] wrote:
>> Hello,
>>
>> I am running a Commerce-shop with TYPO3 4.3.1, added "com_ordernumber"
>> for "friendly" ordernumbers and an extra extension we wrote to apply
>> some hooks. We offer 3 paymentmethods: debit, iDeal and invoice. We
>> use the Commerce SVN-version of December 2009.
>>
>> During testing-fase, everything worked fine but as soon as we put it
>> into production, we noticed that around 1-2% of the orders get
>> duplicated in the database, that is, the customer makes 1 order but
>> this gets registrated in the database as 2, 3 or 4 different orders,
>> each with a unique ordernumber. Only the latest order (highest
>> ordernumber) is send to the customer per email.
>>
>> As you will understand, this makes ordermanagement quite messy: we
>> have to look for duplicates by hand and then remove them.
>>
>> What could be wrong here? I really do not understand why this happens?
>> How to debug?
>>
>> Some extra comments:
>>
>> *) The shop was heavily visited just after launch (3-4 orders per
>> minute), more then 1000 orders during the first day. Could this be a
>> reason?
>>
>> *) On the page were the basket is installed, we had to set it to "No
>> cache" due to some strange caching behaviour?
>>
>> *) How heavily Commerce depends of cookies and/or js being enabled?
>>
>> As you notice, the above are just some guesses since I do not see a
>> clear pattern between cause and consequence.
>>
>> Any idea on this would be highly appreciated.
>>
>> Thanks and regards,
>>
>> Bert Hiddink
>> BENDOO
More information about the TYPO3-project-commerce
mailing list