Microsoft KB Archive/320781

= OrderTracking Row Insert Unsuccessful Under Stress and Commerce Server Event 4104 Logged =

Article ID: 320781

Article Last Modified on 10/30/2002

-

APPLIES TO


 * Microsoft Commerce Server 2002 Standard Edition

-



This article was previously published under Q320781



SYMPTOMS
Intermittently, the following event is logged on the Commerce Server computer: Event Type:     Error Event Source:   Commerce Server 2000 Event Category: None Event ID:       4104 Date:           3/13/2002 Time:           3:18:53 PM User:            N/A Computer:        Description: Pipeline Error: Component Execution failed for component[0x8]  hr: 0x80020101 ProgID: Commerce.Scriptor.1 MscsExecute failed. Script invocation failed. Violation of PRIMARY KEY constraint 'PK_counters'. Cannot insert duplicate key in object 'counters'. Line: 5. The following type of error occurs in the browser upon checkout: 2002-03-13 20:27:57 157.59.127.25 - 157.59.127.25 443 POST /payment.asp _Cannot_insert_duplicate_key_in_object_'counters'. 500 702 1520 The following error is logged in the pipeline log: PIPELINE:-- component [0x8] returned hr: 0x80020101, IErrorLevel=4 in 36125 milliseconds Error Description: Component Execution failed for component[0x8] hr: 0x80020101ProgID: Commerce.Scriptor.1MscsExecute failed.Script invocation failed.Violation of PRIMARY KEY constraint 'PK_counters'. Cannot insert duplicate key in object 'counters'.Line: 5. PIPELINE:-- 2002/03/20 13:44:41.0025 Pipeline Execution completed returning hr: 0x80020101             i:  0x9         hrLoop: 0x80020101 *plErrorLevel:  1000(=====MTS ABORTed=====) Sink stopped at 2002/03/20 13:44:41.0025 The following statements are logged in a Microsoft SQL Server trace log around the time the error occurs: exec sp_cursor 180150000, 4, 0, N'counters', @next = 1, @countername = N'OrderTracking' SELECT next, countername FROM counters WHERE countername = 'OrderTracking'
 * 217|80040e2f|Violation_of_PRIMARY_KEY_constraint_'PK_counters'.



CAUSE
SaveAsOrder is implementing the counter saving operations. The SQL Server routine has the command that results in a timeout and then an attempt to insert a row that already exists. SQL Server returns the error as a result.



RESOLUTION
To resolve this contention issue, do one of the following:  Set DTCTimeout to be less than CommandTimeout. In this way a Microsoft Distributed Transaction Coordinator (DTC) timeout may occur and be handled instead of the silent lock-timeout in which the SQL Server processing fails. Verify that the following setting (default) is set:  Open Administrative Tools. For IIS, click Component Services. COM+ Packages. Click Local Computer. Click Properties.</li> Click the Options tab.</li> Specify 60 (seconds) for the DTC timeout.</li></ol> </li>  Configure the site code for each site to use a unique counter. To do this, explicitly set OrderGroup.OrderTrackingNumber in the site code and use a different counter name for each Web site. This will reduce the lock contention and thereby resolve this problem. For example, use the following sample code as a basis for modifying the Include\Payment.asp code: If IsNull(mscsOrderGrp.Value(&quot;order_number&quot;)) set objGenID = Server.CreateObject(&quot;Commerce.GenID&quot;) mscsOrderGrp.Value(&quot;order_number&quot;) = objGenID.GetCounterValue(&quot;OrderTracking<SiteName/Number>&quot;, 0) End If mscsOrderGrp.SaveAsOrder </li> Use dedicated transaction databases for each site. To do this, divide the one transaction database into multiple transaction databases. You can create one database for each site. When you do this, each site does not share resources, which helps to stop the contention of the OrderTracking SQL Server row that is used for the counter.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in Microsoft Commerce Server 2002.

<div class="moreinformation_section">

MORE INFORMATION
The GenID object is used to create and maintain global sequential counters that are persisted in the database. The OrderGroup component uses GenID to generate a unique order ID when you call SaveAsOrder. The GenID component performs an insert in the Counters table in the transactions database when an existing row for a particular counter name is not found. If a row for that counter name (&quot;OrderTracking&quot; by default) already exists, an update occurs.

Keywords: kbbug kbfix kbcommserv2000presp2fix kbcommserv2000sp2fix KB320781

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.