Developer forum

Forum » Development » DBConcurrencyException: Concurrency violation

DBConcurrencyException: Concurrency violation

Tomas Gomez
Reply

Hi,

We get this exception sometimes, on the home page after restarting the solution. The exception is triggered only once, as it doesn't appear after refreshing or going to another page.

What if the reason for this exception? Any clue?

 

Regards,
Tomas

รง

 

 


Replies

 
Tomas Gomez
Reply

There are other posts with similar questions on:

  • https://doc.dynamicweb.com/forum/development/development/system-data-dbconcurrencyexception-concurrency-violation-in-payment-provider
  • https://doc.dynamicweb.com/forum/development/development/concurrency-violation-exception-in-ecommerce
 
Nicolai Pedersen
Reply

Hi Tomas

Your dump is missing.

Thanks, Nicolai

 
Tomas Gomez
Reply

Sorry, I send it as an attachment

concurrency_exception.png
 
Tomas Gomez
Reply

Hi again, 

the error is still there, does somebody got a clue about the reason?

This is the log error:

2021-02-17 11:00:08.925: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
System.Data.DBConcurrencyException: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order)
at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
at Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext)
at Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext)
at Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext)
at Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext)
at Dynamicweb.Ecommerce.Frontend.Cart.CartCatch.CatchCart(Int32 pageId, PageView pageView)
at Dynamicweb.Ecommerce.Frontend.EcomPageLoadNotificationSubscriber.LoadedPage(PageView pageview)
at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
at Dynamicweb.Frontend.PageView.Load()
at Dynamicweb.Frontend.DynamicwebHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
2021-02-17 11:00:08.956: Request headers: [   "Connection",   "Content-Length",   "Accept",   "Accept-Encoding",   "Accept-Language",   "Cookie",   "Host",   "User-Agent",   "sec-ch-ua",   "sec-ch-ua-mobile",   "upgrade-insecure-requests",   "sec-fetch-site",   "sec-fetch-mode",   "sec-fetch-user",   "sec-fetch-dest",   "X-Original-URL" ]
2021-02-17 11:00:08.956: Request item keys: [   "Order.Field.Collection.SELECT *  FROM EcomOrderField ORDER BY OrderFieldSort",   "eCommerce.Price.CachedPrices",   "owin.Environment",   {},   "EcomCart:CustomCartContext",   "Dynamicweb.Analytics.VisitorCookie",   "MS_HttpRequestMessage",   "AspSession",   "PermissionContextStack",   "Dynamicweb.OMC.VisitContext",   "QubbosLiveIntegrationAddInWebServiceURI",   "AspSessionIDManagerInitializeRequestCalled",   "Price.Collection.SELECT EcomPrices.* FROM EcomPrices WHERE PriceProductID=\u0027PROD7742\u0027 ORDER BY PriceID",   "alternateUrlKey",   "ExecutionTableMapper",   "Price.Collection.SELECT EcomPrices.* FROM EcomPrices WHERE PriceProductID=\u0027PROD3472\u0027 ORDER BY PriceID",   "DWPAGEVIEW",   "Dynamicweb.Environment.Web",   "Dynamicweb.Tracking.Tracker" ]
2021-02-17 11:00:08.956: Request form: []

 

 

concurrency_violation.png
 
Anders Ebdrup
Anders Ebdrup
Reply

We see the same issue as Tomas

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I can confirm we see the same thing sometimes.

In our case, we have isolated one of the cases to an update on an order (usually because of a delayed payment confirmation).

But we have also seen it from time to time (on various versions) even in development instances where the payment is out of the equation.

It looks like it is not an isolated case but it seems pretty hard to reproduce it consistently.

 

Adrian

 
Anders Ebdrup
Anders Ebdrup
Reply

When a user is starting up on the shop we also see errors like this (stack trace is from 9.10):

 

[InvalidOperationException: Collection was modified; enumeration operation may not execute.]
   System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) +56
   System.Collections.Generic.Enumerator.MoveNextRare() +14657978
   Dynamicweb.Ecommerce.Orders.OrderService.ClearCachedPrices(Order order) +147
   Dynamicweb.Ecommerce.Orders.OrderLineCollection.Add(OrderLine orderLine) +53
   Dynamicweb.Ecommerce.Orders.Order.get_OrderLines() +263
   Dynamicweb.Ecommerce.Orders.OrderService.ClearCachedPrices(Order order) +40
   Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext) +43
   Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext) +114
   Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext) +678
   Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext) +53
   Dynamicweb.Ecommerce.Frontend.Cart.CartCatch.CatchCart(Int32 pageId, PageView pageView) +550
   Dynamicweb.Ecommerce.Frontend.EcomPageLoadNotificationSubscriber.LoadedPage(PageView pageview) +407
   Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs) +866
   Dynamicweb.Frontend.PageView.Load() +2633
   Dynamicweb.AspNet.DynamicwebHttpHandler.ProcessRequest(HttpContext context) +50
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +790
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +88
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

We're getting it too, for sites with a single currency. We've had this on a few sites and I thought that they went away with upgrades, but the site below just reported it on 9.9.3.

 
Unnsteinn Garðarsson
Unnsteinn Garðarsson
Reply

We have a site using 9.9.8 and we have the same error, it has been reported from a few customers when they open the webshop, but it is resolved with a reload. AFAIK it has been happening from time to time for a while now, at least half a year, probably longer.

 
Allan Iversen
Allan Iversen
Reply

Any update on this? - we too get these on our customer solutions from time to time.

 
Nicolai Pedersen
Reply

Hi Allan

Yes - we are working on a solution and is close to testing stage. This is a really difficult one for us, because it affects the order of how orders are calculated and passed to and from live integration and other risky stuff. But we have a solution that we think will take care of all these scenarios and also fix this problem. The testing of this will be thorough because of the risk, and might also take a bit of time.

BR Nicolai

 
Allan Iversen
Allan Iversen
Reply

Sounds great - we wait for this.

 
Tomas Gomez
Reply

Hi,

We updated to DW 9.10.13 and the error is still there. Have to mention that, as far as now, it happens no so often as with previous version DW 9.9.6

Regards,
Tomas

 
Nicolai Pedersen
Reply

Can you provide a screendump or full stracktrace?

What kind of custom code do you have that calls order.save?

 
Tomas Gomez
Reply

Hi Nicolai,

Thanks for the prtompt reply.

Last time happened to a colleague, just starting a new window at the home page. The info and content of the error is:

User Name: System
Url: /
Description: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
Created: Wed, 15 Sep 2021 09:19 (UTC+02:00)
Machine name: DW-D014
Exception type: DBConcurrencyException

2021-09-15 09:19:42.741: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
System.Data.DBConcurrencyException: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order)
at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
at Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext)
at Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext)
at Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext)
at Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext)
at Dynamicweb.Ecommerce.Frontend.Cart.CartCatch.CatchCart(Int32 pageId, PageView pageView)
at Dynamicweb.Ecommerce.Frontend.EcomPageLoadNotificationSubscriber.LoadedPage(PageView pageview)
at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
at Dynamicweb.Frontend.PageView.Load()
at Dynamicweb.AspNet.DynamicwebHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
2021-09-15 09:19:42.803: Request headers: [   "Connection",   "Accept",   "Accept-Encoding",   "Accept-Language",   "Cookie",   "Host",   "User-Agent",   "sec-ch-ua",   "sec-ch-ua-mobile",   "sec-ch-ua-platform",   "upgrade-insecure-requests",   "sec-fetch-site",   "sec-fetch-mode",   "sec-fetch-user",   "sec-fetch-dest" ]
2021-09-15 09:19:42.803: Request item keys: [   "DynamicwebLiveIntegrationIsIntegrationActive",   "owin.Environment",   "EcomCart:CustomCartContext",   {},   "AspSession",   "PermissionContextStack",   "QubbosLiveIntegrationAddInWebServiceURI",   "AspSessionIDManagerInitializeRequestCalled",   "alternateUrlKey",   "ExecutionTableMapper",   "DWPAGEVIEW",   "Dynamicweb.Environment.Web",   "MS_HttpRequestMessage",   "Dynamicweb.Tracking.Tracker" ]
2021-09-15 09:19:42.803: Request form: []

The ruote and the last line "Request headers" slightly changes in other errors, for instance:

2021-09-13 09:23:47.289: Request headers: [   "Connection",   "Accept",   "Accept-Encoding",   "Accept-Language",   "Cookie",   "Host",   "Referer",   "User-Agent",   "sec-ch-ua",   "sec-ch-ua-mobile",   "upgrade-insecure-requests",   "sec-fetch-site",   "sec-fetch-mode",   "sec-fetch-user",   "sec-fetch-dest" ]
2021-09-13 09:23:47.289: Request item keys: [   "Order.Field.Collection.SELECT *  FROM EcomOrderField ORDER BY OrderFieldSort",   "owin.Environment",   "EcomCart:CustomCartContext",   "MS_HttpRequestMessage",   "AspSession",   "PermissionContextStack",   "QubbosLiveIntegrationAddInWebServiceURI",   "AspSessionIDManagerInitializeRequestCalled",   "alternateUrlKey",   "ExecutionTableMapper",   "DWPAGEVIEW",   {},   "Dynamicweb.Environment.Web",   "DynamicwebLiveIntegrationIsIntegrationActive",   "Dynamicweb.Tracking.Tracker" ]

2021-09-13 01:43:59.337: Request headers: [   "Connection",   "Accept",   "Accept-Encoding",   "Accept-Language",   "Cookie",   "Host",   "User-Agent",   "Upgrade-Insecure-Requests",   "Sec-Fetch-Site",   "Sec-Fetch-Mode",   "Sec-Fetch-User",   "Sec-Fetch-Dest" ]
2021-09-13 01:43:59.337: Request item keys: [   "DynamicwebLiveIntegrationIsIntegrationActive",   "owin.Environment",   "EcomCart:CustomCartContext",   "MS_HttpRequestMessage",   "AspSession",   "PermissionContextStack",   "QubbosLiveIntegrationAddInWebServiceURI",   "AspSessionIDManagerInitializeRequestCalled",   "alternateUrlKey",   "ExecutionTableMapper",   "DWPAGEVIEW",   {},   "Dynamicweb.Environment.Web",   "Dynamicweb.Tracking.Tracker" ]
2021-09-13 01:43:59.337: Request form: []

 

As well, I attach an image with errors at monitoring

Regards,
Tomas

 

concurrency_violation.png
 
Tomas Gomez
Reply

Hi Nicolai,

Is that trace useful to search for the error?

Our custom code save the orders from several places, but it doen't appear any of tem in the trace (they usually appear when there is an error in our code)

Regards,
Tomas

 
Allan Iversen
Allan Iversen
Reply

Any update on this one - we have also observed this on DW 9.15?

BR

Allan

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Allan

These are usually related to custom code or integration code that does orderline.save or order.save.

Can you tell us if you have any notification subscribers that does anything related to orders?

And do you have a stack trace of when this issue appears?

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

Happy new year.

Sure - I had to look into this. In all our cases the exception is thrown right after login. It happens periodically.

Any idea how to circumvent this on DW 9.9.8?

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 04/01/2024 13:24:03 
Event time (UTC): 04/01/2024 12:24:03 
Event ID: afd73ab513914a09b3ca88b9f053f7b7 
Event sequence: 129979 
Event occurrence: 36 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/2/ROOT-4-133487732124157931 
    Trust level: Full 
    Application Virtual Path: / 
 
Process information: 
    Process ID: 13060 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\NETWORK SERVICE 
 
Exception information: 
    Exception type: DBConcurrencyException 
    Exception message: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
   at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order)
   at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext)
   at Dynamicweb.Ecommerce.Cart.Notifications.AfterLoginSubscriber.OnNotify(String notification, NotificationArgs args)
   at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
   at Dynamicweb.Frontend.LogOnHandler.LogOn(String username, String password, Boolean onlyActive, Boolean impersonateUser, Int32 impersonateUserId, Boolean skipPasswordCheck)
   at Dynamicweb.Frontend.SecurityHandler.ExtranetStart()
   at Dynamicweb.Frontend.LoginHandler.ExtranetStart(Int32 pageId)
   at Dynamicweb.Frontend.PageView.Load()
   at Dynamicweb.Frontend.DynamicwebHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 
 
Request information: 
    Request path: /Default.aspx 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: NT AUTHORITY\NETWORK SERVICE 
 
Thread information: 
    Thread ID: 446 
    Thread account name: NT AUTHORITY\NETWORK SERVICE 
    Is impersonating: False 
    Stack trace:    at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order)
   at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext)
   at Dynamicweb.Ecommerce.Cart.Notifications.AfterLoginSubscriber.OnNotify(String notification, NotificationArgs args)
   at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
   at Dynamicweb.Frontend.LogOnHandler.LogOn(String username, String password, Boolean onlyActive, Boolean impersonateUser, Int32 impersonateUserId, Boolean skipPasswordCheck)
   at Dynamicweb.Frontend.SecurityHandler.ExtranetStart()
   at Dynamicweb.Frontend.LoginHandler.ExtranetStart(Int32 pageId)
   at Dynamicweb.Frontend.PageView.Load()
   at Dynamicweb.Frontend.DynamicwebHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 
 
Custom event details: 

 
Allan Iversen
Allan Iversen
Reply

Just a thought... - if I tried to save the order, caught the potential exception and stopped the execution in OrderService.Save(Order order, bool saveOldVersion) using a combination of DWN_STANDARD_USER_OnExtranetLogin and DWN_ECOM_ORDER_BEFORE_SAVE - this might eliminate the exception thrown to frontend (which disappears right after refreshing the page). 

However the question why this happens left unanswered.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Allan

It is a concurrency issue that is related to the same db record is in 2 different order objects in memory/session. It could be related to the "Recalculate a user's cart when the user logs in" setting in Settings->Ecommerce->Advanced->Cart or the "Keep anonymous cart when user logs in" in the same place. Both will do some cart loading and as part of that this exception can occur.

I have seen subscribers in live integration that will also call the cart save as part of the price calculation or other things and that can cause this issue.

What are your settings for the 2 checkboxes? And can you re-produce the issue to test what happens if they are disabled?

BR Nicolai

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

Makes sense.

We are using the "Recalculate a user's cart when the user logs in" - I will do some testing related to this settings.

Much appreciated.

BR Allan

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

Unfortunately we are still experiencing DBConcurrencyException even after I disabled the "Recalculate a user's cart when the user logs in" setting.

Do we got other explanations why we are experiencing this behaviour?

Exception information: 
    Exception type: DBConcurrencyException 
    Exception message: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
   at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order)
   at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext)
   at Dynamicweb.Ecommerce.Cart.Notifications.AfterLoginSubscriber.OnNotify(String notification, NotificationArgs args)
   at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
   at Dynamicweb.Frontend.LogOnHandler.LogOn(String username, String password, Boolean onlyActive, Boolean impersonateUser, Int32 impersonateUserId, Boolean skipPasswordCheck)
   at Dynamicweb.Frontend.LogOnHandler.CookieLogon()
   at Dynamicweb.Frontend.SecurityHandler.ExtranetStart()
   at Dynamicweb.Frontend.LoginHandler.ExtranetStart(Int32 pageId)
   at Dynamicweb.Frontend.PageView.Load()

2024-01-08_144947.png
 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

You still did not answer my questions on if you have live integration and what happens inside that live integration. I need to see the code....

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Or anything else that touches an order in a notification.

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

Sorry, no live integration on this solution.

The exception does always originate from Dynamicweb.Ecommerce.Cart.Notifications.AfterLoginSubscriber. Both UsePreviousCartInsteadOfNewCart and RecalculateOnUserLogin settings are disabled. 

After these conditions in OnNotify - the following is called which could set this off.

Services.Carts.SaveCartCookie(Context.Cart, val.User, Context.CartContext);

We do use the same Context.Cart in our OnExtranetLogin.OnNotify but the exception never originates from here (looking at the stack trace).

BR Allan

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Allan

It might not be your notification that is in the stack trace, but could be the one which causes it as it changes the object as well - so it is this problem with 2 instances that are both saved.

So - what would you like us to do? The problem is fixed in a much later version, but that propably does not help you much.

BR Nicolai

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Allan

I'll have Care reach out and talk to you about next steps.

BR Nicolai

 
Allan Iversen
Allan Iversen
Reply

Hi Nicolai,

By coincidence we have got reported the exact same exception on a much newer DW version (9.15.14) to day.

In this case we do not have any lookups on GetCart when logging in.

In our case this always occurs when logging in.

What kind fix did you make on this? - from which version is this fixed. Will it be possible to bypass or handling the exception before thrown to frontend?

Process information: 
    Process ID: 5156 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\NETWORK SERVICE 
 
Exception information: 
    Exception type: DBConcurrencyException 
    Exception message: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
   at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at Dynamicweb.Ecommerce.Orders.OrderRepository.Save(Order order)
   at Dynamicweb.Ecommerce.Orders.OrderService.Save(Order order, Boolean saveOldVersion)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.SaveCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.SetCart(Order cart, User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Frontend.Cart.CartService.LoadCart(User user, OrderContext orderContext)
   at Dynamicweb.Ecommerce.Common.Context.GetCart(OrderContext orderContext)
   at Dynamicweb.Ecommerce.Cart.Notifications.AfterLoginSubscriber.OnNotify(String notification, NotificationArgs args)
   at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
   at Dynamicweb.Frontend.LogOnHandler.LogOn(String username, String password, Boolean onlyActive, Boolean impersonateUser, Int32 impersonateUserId, Boolean skipPasswordCheck)
   at Dynamicweb.Frontend.SecurityHandler.ExtranetStart()
   at Dynamicweb.Frontend.LoginHandler.ExtranetStart(Int32 pageId)
   at Dynamicweb.Frontend.PageView.Load()
   at Dynamicweb.AspNet.DynamicwebHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

BR Allan

 

 

You must be logged in to post in the forum