A delay in the Order Processing Pipeline of Commerce Server may cause a memory leak (328549)



The information in this article applies to:

  • Microsoft Commerce Server 2000

This article was previously published under Q328549

SYMPTOMS

When a delay is introduced in the Order Processing Pipeline (OPP) of Microsoft Commerce Server 2000, a memory leak may occur. For example, a time delay may be introduced to process credit card information.

CAUSE

The Commerce Server 2000 Retail Solution Site contains many areas where transaction delays may last 3 to 5 seconds. These transaction delays may cause memory leaks.

RESOLUTION

To avoid this behavior, Microsoft recommends that you install Microsoft Data Access Components (MDAC) 2.7 Service Pack 1 (SP1). For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

320696 OLE DB session pooling causes 100 percent CPU usage (MDAC 2.7)

820910 INFO: How to obtain the latest MDAC 2.7 service pack

In addition to applying MDAC 2.7 SP1, you may also modify the retail site code. To modify the Retail Solution Site code for the Commerce Server 2000 and Commerce Server 2002 Retail Solution Sites, follow these steps:
  1. Change the Main function in the Inetpub\Wwwroot\Retail\Category.asp file. To do this, add the rsProducts.Close statement in the following code:
    	FetchCategoryData sPageTitle, sCatalogName, sCategoryName, iPageNumber
    	Call EnsureUserHasRightsToCatalog(sCatalogName, m_UserID)
    	htmPageContent = htmCachedProductList(sCatalogName, sCategoryName, iPageNumber, sCacheKey)
    	If IsNull(htmPageContent) Then '<< No cached HTML found, generate it
    		Set oCatalog = MSCSCatalogManager.GetCatalog(sCatalogName)
    		If oCatalog Is Nothing Then
    			Response.Redirect(GenerateURL(MSCSSitePages.BadCatalogItem, Array(), Array()))
    		End If
    		Set oCategory = mscsGetCategoryObject(oCatalog, sCategoryName)
    		Set rsProducts = mscsGetProductList(oCatalog, oCategory, iPageNumber, nRecordsTotal, nOutPagesTotal)
    		htmPageContent = htmCategoryHTML(oCatalog, sCatalogName, sCategoryName, oCategory, rsProducts, _
                      iPageNumber, nOutPagesTotal, sCacheKey)
    		rsProducts.Close()
    		Set rsProducts = Nothing
    		Set oCategory = Nothing
    		Set oCatalog = Nothing
    	End If
    				
  2. Change the Main subroutine in the Inetpub\Wwwroot\Retail\Default.asp file. To do this, add the following lines of code
    rsCatalogs.Close()
    set rsCatalogs = Nothing
    rsProducts.Close()
    set rsProducts = Nothing
    to the following code as shown:
    Sub Main()
    	Dim CatalogSetID
    	Dim rsCatalogs, rsProducts
    	Dim iCatalogCount, nPageNumber
    	Dim sCatalogName
    	Dim oCatalog, oCategory
        
    	Call EnsureAccess()
    	
    	CatalogSetID = mscsUserCatalogsetID()
    	htmPageContent = LookupCachedFragment("DefaultPageCache", CatalogSetID)
    	If IsNull(htmPageContent) Then
    		Call PrepareDefaultPage(CatalogSetID, rsCatalogs, iCatalogCount, sCatalogName, _
                      oCatalog, oCategory, rsProducts, nPageNumber)
    		htmPageContent = htmRenderDefaultPage(CatalogSetID, rsCatalogs, iCatalogCount, _
                      sCatalogName, oCatalog, oCategory, rsProducts, nPageNumber)
    
    		rsCatalogs.Close()
                    set rsCatalogs = Nothing
    		rsProducts.Close()
                  	set rsProducts = Nothing
    	End If
    End Sub
    				
  3. Change the arrSearchDept function in the Inetpub\Wwwroot\Srchdept.asp file. To do this, add the following line of code
    rsCatalogs.Close()
    to the following code as shown:
    	Loop
    	' Delete the final line separator.
    	rsCatalogs.Close()
    	Set rsCatalogs = Nothing
    	If Len(sResult) > Len(LINESEPARATOR) Then
    		sResult = Left(sResult, Len(sResult)-Len(LINESEPARATOR))
    	End If
    	arrSearchDept = Split(sResult, LINESEPARATOR)
    				
  4. Change the sUserCatalogsAsString function in the Inetpub\Wwwroot\Retail\Include\Catalog.asp file. To do this, add the following line of code
    rsCatalogs.Close()
    to the following code as shown:
    Function sUserCatalogsAsString()
    	Dim sCatalogName, sResults
    	Dim rsCatalogs
    	Dim bFound
    	bFound = False
    	
    	Set rsCatalogs = mscsUserCatalogs()
    	
    	While Not rsCatalogs.EOF
    		bFound = True
    		sCatalogName = rsCatalogs(CATALOG_NAME_PROPERTY_NAME)
    		sResults = sResults & sCatalogName & ","
    		
    		rsCatalogs.MoveNext()
    	Wend
    	If bFound Then sResults = Left(sResults, Len(sResults) - 1)
    	rsCatalogs.Close()
    	Set rsCatalogs = Nothing
    
    	sUserCatalogsAsString = sResults
    End Function	
    				
  5. Change the GetOrderGroup function in the Inetpub\Wwwroot\Retail\Include\Std_ordergrp_lib.asp file. To do this, add the following line of code
    set mscsOrderGrp = nothing
    to the following code as shown:
    Function GetOrderGroup(ByVal sOrderID)
    	Dim mscsOrderGrp
    	
    	Set mscsOrderGrp = Server.CreateObject("Commerce.OrderGroup")
    	Call mscsOrderGrp.Initialize(dictConfig.s_TransactionsConnectionString, sOrderID)
    	Set GetOrderGroup = mscsOrderGrp
    	Set mscsOrderGrp = nothing
    End Function
    
    				
  6. Add the following two lines of code
    rsCatalogs.Close()
    set rsCatalogs = Nothing
    to the Inetpub\Wwwroot\Retail\Template\Menu.asp file in the following location:
    	' **************
    	' Catalog section
    	' **************
    	htmCatalogSection = LookupCachedFragment("StaticSectionsCache", CatalogSetID)
    	If IsNull(htmCatalogSection) Then
    		Call PrepareCatalogSection(rsCatalogs, iCatalogCount, oCatalog, sCatalogName,  rsCategories)
    		htmCatalogSection = htmRenderCatalogSection(MSCSSiteStyle.Body, rsCatalogs, iCatalogCount, _
                      oCatalog, sCatalogName,  rsCategories)
    		rsCatalogs.Close()
    		set rsCatalogs = Nothing
    		Call CacheFragment("StaticSectionsCache", CatalogSetID, htmCatalogSection)
    	End If
    				

Modification Type:MinorLast Reviewed:2/24/2004
Keywords:kbprb kbinfo KB328549 kbAudDeveloper