Checkout Failed 100 times

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Checkout Failed 100 times

Post by ZLA » Mon Jun 08, 2009 2:41 pm

I'm working on some trigger code that is causing an error during checkout. In tracking down my error, I see that checkout attempted the SQL statement a hundred times before giving up. This definitely makes the app log verbose.

Is this a setting that can be changed somewhere? If it can be changed, should it or are there good reasons why 100 times is necessary or preferred?

The only other post that seemed relevant said checkout failed three times before aborting. That is more like what I expected.

Here is the error message in case it's pertinent:

Code: Select all

ERROR 2009-06-08 16:06:47,203 19995453ms Object                 a                  - An error occurred during the checkout process.  The checkout has failed 100 times and will NOT BE attempted again. UserId: 1 / Me@MyComputer.com Customer: Abe Adams / Me@MyComputer.com / 333-333-3333
System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "ac_OrderItems_ac_OrderItemInputs_FK1". The conflict occurred in database "MyStoreDev", table "dbo.ac_OrderItems", column 'OrderItemId'.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteScalar()
   at CommerceBuilder.Data.Database.ExecuteScalar(DbCommand command)
   at CommerceBuilder.Orders.OrderItemInput.Save()
   at CommerceBuilder.Orders.a.b(Basket A_0, Order A_1, Dictionary`2 A_2)
   at CommerceBuilder.Orders.Basket.Checkout(CheckoutRequest checkoutRequest, Boolean validate, Boolean triggerEvents)

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Checkout Failed 100 times

Post by Logan Rhodehamel » Mon Jun 08, 2009 4:15 pm

This is for purposes of locking and retry failover. If two people attempt checkout at the same time, and a sql deadlock occurs, AbleCommerce rolls back and attempts the checkout again. It will attempt this up to 100 times before giving up. Our goal was to be highly reliable under load and not drop orders.

Under normal circimstances this works. But the customization you made is triggering the checkout failure.

You could alter the 100 value. I think there is an undocumented web.config setting but I would have to look it up. Are you interested? It won't change the fact that you have to fix whatever is breaking your checkout. :)
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Checkout Failed 100 times

Post by ZLA » Mon Jun 08, 2009 4:22 pm

Thank you Logan. I just wanted the information since 100 seemed high but I don't plan to change it. I have to take another tack on the trigger code anyway due to foreign key issues and the use of @@IDENTITY in AC Code instead of ScopeIdentity(). Thanks.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Checkout Failed 100 times

Post by Logan Rhodehamel » Mon Jun 08, 2009 4:29 pm

ZLA wrote:Thank you Logan. I just wanted the information since 100 seemed high but I don't plan to change it. I have to take another tack on the trigger code anyway due to foreign key issues and the use of @@IDENTITY in AC Code instead of ScopeIdentity(). Thanks.
Honestly I never thought the issue would come up. I think in load testing the worst I ever measured was three or four retries. But I was testing specifically for deadlocks. After we proofed the transaction code I never gave the retry number a second thought.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Checkout Failed 100 times

Post by Logan Rhodehamel » Mon Jun 08, 2009 4:43 pm

ZLA wrote:use of @@IDENTITY in AC Code instead of ScopeIdentity(). Thanks.
This is nagging at me. I could swear there was a reason for this, but now I can't identify it. I am going to log a bug to research it further. It seems Scope Identity would be more appropriate for our purpose.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Checkout Failed 100 times

Post by ZLA » Mon Jun 08, 2009 4:45 pm

Once I found out about ScopeIdentity, I started using it instead of @@IDENTITY. But I have to say I did not go back through my existing code base and update all the old references. :)

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Checkout Failed 100 times

Post by Logan Rhodehamel » Mon Jun 08, 2009 4:48 pm

ZLA wrote:Once I found out about ScopeIdentity, I started using it instead of @@IDENTITY. But I have to say I did not go back through my existing code base and update all the old references. :)
At first I thought it might be related to our expected compatibility with MySQL. But that isn't the case. Then I thought maybe it wasn't supported by SQL 2000, but that isn't the case either. I know I looked at this issue. I wish I could remember why I chose @@IDENTITY. But it was probably two years ago... memory fuzzy.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

ZLA
Commodore (COMO)
Commodore (COMO)
Posts: 496
Joined: Fri Mar 13, 2009 2:55 pm

Re: Checkout Failed 100 times

Post by ZLA » Mon Jun 08, 2009 4:53 pm

Perhaps for clustering or something like that? I think @@Identity is across connections etc. So perhaps one of the limitations of ScopeIdentity wouldn't work in that scenario. Or maybe replication issues? I can't think of anything obvious, though.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Checkout Failed 100 times

Post by Logan Rhodehamel » Mon Jun 08, 2009 4:57 pm

ZLA wrote:Perhaps for clustering or something like that? I think @@Identity is across connections etc. So perhaps one of the limitations of ScopeIdentity wouldn't work in that scenario. Or maybe replication issues? I can't think of anything obvious, though.
I don't think any of those apply. We always select the identity as part of a compound statement, right after the insert, on the same connection. I can't see why Scope_Identity wouldn't be more perfect. In any case, the bug is logged and it will get looked at further.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

AlanW
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 42
Joined: Wed Apr 08, 2009 12:47 pm

Re: Checkout Failed 100 times

Post by AlanW » Wed Jun 17, 2009 6:42 am

Similar error this morning. Error log recorded three errors in a row, 10:27:50 then 10:28:05 then 10:28:08 PM. All the same error message and debug data.

Code: Select all

An error occurred during the checkout process. The checkout has failed 100 times and will NOT BE attempted again. UserId: 61144 / customer@verizon.net Customer: XXXXXXX XXXX/ customer@verizon.net / 

Code: Select all

Cannot insert the value NULL into column 'TotalCharges', table 'practic_ac7master.practic_sqluser.ac_Orders'; column does not allow nulls. UPDATE fails. The statement has been terminated.
Eventually an order was completed for the customer with a timestamp pf 10:08. If it helps, the payment method was PayPal. Who knows if that was same payment method used during the checkout problem.

--Alan
Last edited by AlanW on Wed Jun 17, 2009 10:37 am, edited 1 time in total.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Checkout Failed 100 times

Post by AbleMods » Wed Jun 17, 2009 9:46 am

FWIW, since the 7.0.2 upgrade the trigger I had on my ac_Orders breaks my checkout. It throws a foreign key constraint on ac_shipments.

My theory is the trigger is causing some sort of error. Since SQL 2005 automatically performs a rollback on the transaction if a SQL trigger errors, the foreign key constraint kicks in during the order save process because a shipment is trying to be written for an order that (now) doesn't exist.

For the life of me I cannot figure out why the trigger fails. When I execute the trigger code as a standalone script, it runs flawlessly every time. All I'm doing is inserting a record into a custom table. Complete unexpected behavior and was never a problem in previous AC7 versions.

All began when 7.0.2 upgrade was installed.........
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Checkout Failed 100 times

Post by jmestep » Wed Jun 17, 2009 10:06 am

Alan,
You might want to edit your post and take out the person's email address.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Checkout Failed 100 times

Post by jmestep » Wed Jul 01, 2009 2:53 pm

I just got the error on a 7.0.2 site.
at CommerceBuilder.Orders.Basket.Checkout(CheckoutRequest checkoutRequest, Boolean validate, Boolean triggerEvents)
WARN 2009-06-24 19:27:44,624 78733204ms Object a - Error running SQL: UPDATE ac_Orders SET TotalCharges = (SELECT SUM(Quantity * Price) As TotalCharges FROM ac_OrderItems WHERE OrderId = @orderId), ProductSubtotal = @productSubtotal WHERE OrderId = @orderId
System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'TotalCharges', table 'xxxstore.dbo.ac_Orders'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at CommerceBuilder.Data.Database.ExecuteNonQuery(DbCommand command)
INFO 2009-06-24 19:27:44,624 78733204ms Object a - An error occurred during the checkout process. The checkout will be attempted again. UserId: 224996 /
Weird, looks out is started out with PaypalExpress checkout, and look how the order number changed
One.jpg
Two.jpg
I think I'll post a bug.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

bjnoffsi
Ensign (ENS)
Ensign (ENS)
Posts: 3
Joined: Mon Oct 12, 2009 3:52 pm

Re: Checkout Failed 100 times

Post by bjnoffsi » Thu Oct 22, 2009 7:48 am

Is there a fix (patch) available for this bug? On our site, it's happening for some users checking out with PayPal Express. We have PayPal authorization mode set to "sale" and handlefailedpayments on the receipt page set to true.

Is this the fix:
http://bugs.ablecommerce.com/show_bug.cgi?id=8351

Thanks!

User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: Checkout Failed 100 times

Post by William_firefold » Fri Oct 23, 2009 7:36 am

I just saw this error in our log as well. We are not under heavy load at the time of the error.

Code: Select all

 	10/23/2009 10:06:00 AM	Error	An error occurred during the checkout process. The checkout has failed 100 times and will NOT BE attempted again. UserId: 25XX421 / xxxxxx@comcast.net Customer: john xxxxxx/ xxxxxx@comcast.net / 610xxx7361	Cannot insert the value NULL into column 'TotalCharges', table 'FireFold.dbo.ac_Orders'; column does not allow nulls. UPDATE fails. The statement has been terminated.

Looking at the customer's order: The order was placed at 9:30AM, but this error did not occur until 36 minutes later. It appears that payment has gone through, and the order will complete. I thought this was strange, it seems like it is caused from paypal communicating with the site once the person logs into their PP account and releases payment.
Thought this might help.

vikas
Ensign (ENS)
Ensign (ENS)
Posts: 1
Joined: Tue Oct 11, 2011 12:11 am

Re: Checkout Failed 100 times

Post by vikas » Tue Oct 11, 2011 12:24 am

I m facign two errors ,and Now its sucks me a loy.
1.
An error occurred during the checkout process. The checkout has failed 100 times and will NOT BE attempted again.
......
Cannot insert the value NULL into column 'TotalCharges', table '....dbo.ac_Orders'; column does not allow nulls. UPDATE fails. The statement has been terminated.


2.
n error has occured at ...../Checkout/Receipt.aspx?OrderNumber=...&OrderId=..... Transaction (Process ID 55) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.


Please Help so that I can solve it.

Thanks & Regards
Vikas

Post Reply