Developer forum

Forum » Development » Concurrency violation exception in ecommerce

Concurrency violation exception in ecommerce

Antek Drzewiecki
Reply

Hello, 

We are experiencing occasionally DBConcurrencyExceptions ( Concurrency violation: the UpdateCommand affected 0 of the expected 1 records. at ) on during our order checkouts and our custom checkout handler.
We managed to resolve most of the concurrency exceptions in the checkout handler. Tough its still a bit vague on which occastions they occur.

In the checkout process we are also experiencing the issues. In the trace logs we see all kinds of sources that possibly don't have under our control such as:

Dynamicweb.Ecommerce.Frontend.EcomPageLoadNotificationSubscriber.LoadedPage(PageView pageview) at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs) (partial tracelog)

 

How can we reduce the amount of concurrency exceptions?
When / why do the concurrency exceptions occur, is it because database save operations are asynchronous?
What are the best practices on saving and editing orders?
Is there also a best practice on building an CheckoutHandler, typically on avoiding these exceptions? 


Replies

 
Nicolai Pedersen
Reply

Hi Antek

I would like to see some of the stack traces from the errors you get. It is not something I've heard of before.

When creating a checkout handler, you often have a situation where the gateway makes a callback using one server-to-server request with no session etc. and then the receipt when the gateway redirects back to the shop. Sometimes one of them comes first, sometimes the other. That is one thing to be aware of - could cause these kind of situations.

Also - do you use your own custom connection string and/or a custom connection provider?

But I need to see your stack fist to give you pointers.

Attached find the source code to all our providers - you might find some things in there to guide you in a 'best practice' direction. That is the best we have.

Thanks, Nicolai

 

You must be logged in to post in the forum