Thursday, October 17, 2013

SharePoint 2010 : Issue got introduced since August 2012 CU

שלום חברים
היום חקרתי בעיות עומס וביצועים, בזמן שאנשים מנסים לנווט לדף הבית באתר שלהם.
לאחר שעמוד חדש פובלש זמני טעינת האתר התחילו לגדול באופן דרמטי או לחילופין בקשות דפים לא סיימו את הטעינה בכלל. אתם תראו "שגיאה צפויה אירעה" הידועה לשמצה.

תוכלו לראות שגיאות ביומן ULS לאחר שמשתמש פרסם דף ולאחר מכן מנסה לפתוח את הדף:

" System.Data.SqlClient.SqlException: Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.  
 at System.Data.SqlClient.SqlConnection.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.HasMoreRows()  
 at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)


Unexpected query execution failure in navigation query, HResult -2146232060. Query text (if available): "BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_GetWebNavStructNodeByIds '1CA27B52-5021-4CE1-AE8A-C553F62481C5','26F979ED-9769-4F91-B29C-CC45C798D393',13730 SELECT @wssp0 = @abort END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0 BEGIN EXEC proc_UpdateDiskUsed '1CA27B52-5021-4CE1-AE8A-C553F62481C5' END "


An unexpected error occurred while manipulating the navigational structure of this Web.


Leaving Monitored Scope (PortalSiteMapNode: Populating navigation children for web: /ABCDEF). Execution Time=66179.2079302278

PortalSiteMapProvider was unable to fetch children for node
at URL: /ABCDEF, message: An unexpected error occurred while manipulating the navigational structure of this Web., stack trace: 
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)  
 at Microsoft.SharePoint.Library.SPRequest.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)  
 at Microsoft.SharePoint.Navigation.SPNavigationNode.Update()  
 at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.UpdateSPNavigationNode(SPNavigationNode node, SPNavigationNode previous, String name, String url, String description, String target, String audience, Boolean forceCreate)  
 at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.UpgradeDraftSPNavigationNode(SPNavigationNode draftNode, SPNavigationNode previous)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.<>c__DisplayClass2.<UpdateNavigationNodes>b__0()  
 at Microsoft.Office.Server.Utilities.Security.SecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, Action secureCode)  
 at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, CodeToRun secureCode)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildrenInner(NodeTypes includedTypes)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildren(NodeTypes includedTypes)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, Boolean trimmingEnabled, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)   
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode node, NodeTypes includedHiddenTypes) "

עם העדכונים של אפריל 2013 CU או כל CU אחרי אפריל 2013 (Service Pack 2. וכו ') ניתן לפתור בעיה זו. ניתן להוריד CU + SP2 מכאן

לאחר התקנת העדכון שך אפריל 2013 CU או כל CU אחרי אפריל 2013 תצטרכו להריץ את הקוד הזה ב- Management Shell של SharePoint :
# Set the Problematic Site Collection
#-----------------------------------------------------
param($url = $(Read-Host -Prompt "SiteCollection Url"))      # Change the Value between the quotes

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


# Log Function
#--------------------
$Logfile = "C:\duplicates_log.txt"

Function LogWrite
{
   Param ([string]$logstring)

   Add-content $Logfile -value $logstring
}



# Utility Functions
#---------------------------
function tryDeleteNode
{
    param($node,$dictionary,$nodeCollection)

    $title = $node.Title
  
               
                    if(!$dictionary.ContainsKey($title))
                    {
                        $dictionary.Add($node.Title,$node.Url)
                    }
                    else
                    {
                        if($dictionary[$title] -eq $node.Url)
                        {
                            if($node.Children.Count -eq 0)
                            {
                                echo "       -> Deleting Duplicate Node: $title"
                                $nodeCollection.Delete($node)
                                $global:didDelete= $true
                                               $temp = (get-date).ToString() +";"+ ($site.Url) +";"+ ($title)
                                               echo "$temp"
                                               LogWrite $($temp)

                            }
                            else
                            {
                                echo "       -> Dupe Node $title has children, Skipping..."
                            }
                        }
                else
                        {
                    echo "       -> Duplicate title $title found, but mismatched link, Skipping..."
                        }
                    }
              
}


function deleteNodesRecurse
{
    $nodes = @{}
    foreach($node in $quickLaunch)
    {
        $childNodes = @{}
        foreach($child in $node.Children)
        {
            tryDeleteNode -node $child -dictionary $childNodes -nodeCollection $node.Children
        }

        tryDeleteNode -node $node -dictionary $nodes -nodeCollection $quickLaunch
    }
}


function deleteGlobalNodesRecurse
{
    $nodes = @{}
    foreach($node in $gnavNodes)
    {
        $childNodes = @{}
        foreach($child in $node.Children)
        {
            tryDeleteNode -node $child -dictionary $childNodes -nodeCollection $node.Children
        }

        tryDeleteNode -node $node -dictionary $nodes -nodeCollection $gnavNodes
    }
}


# The Program Start Here !
#-------------------------------------
$sitecoll = Get-SPSite $url
write-host "SiteCollection: " $sitecoll.URL -foregroundcolor Yellow
foreach ($site in $sitecoll.AllWebs)
{
        write-host " -> Site: " $site.URL -foregroundcolor Green
                do
                {
                               $quickLaunch = $site.Navigation.QuickLaunch
                               $global:didDelete = $false
                               deleteNodesRecurse
                               $pub= [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($site)
                               $gnavNodes = $pub.Navigation.GlobalNavigationNodes;
                               deleteGlobalNodesRecurse
                }
                while($global:didDelete)
                $site.Dispose()
}
$sitecoll.Dispose()


זהו זה, סיימתם !


בהצלחה !
רון נס.

============================================================================================================================================================================================================================================================



Hello Friends
Today I was asked to explore Load and Performance Problems, It's when people are trying to Navigate to the Home Page in their site.

After publishing a new page the site load times start to increase dramatically or page requests don’t finish loading at all. You will see the infamous “An expected error has occurred“-error or if the callstack is enabled and custom errors are turned off in the web.config (CallStack="true" / customErrors mode="Off") you will see a "Request timed out." error-message.

Errors you will see in the ULS log after a user has published a page and then tries to open the page / site containing the page:


" System.Data.SqlClient.SqlException: Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.  
 at System.Data.SqlClient.SqlConnection.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.HasMoreRows()  
 at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock)  
 at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock)


Unexpected query execution failure in navigation query, HResult -2146232060. Query text (if available): "BEGIN TRAN DECLARE @abort int SET @abort = 0 DECLARE @EidBase int,@EidHome int SET @EidBase = 0 SET @EidHome = NULL IF @abort = 0 BEGIN EXEC @abort = proc_GetWebNavStructNodeByIds '1CA27B52-5021-4CE1-AE8A-C553F62481C5','26F979ED-9769-4F91-B29C-CC45C798D393',13730 SELECT @wssp0 = @abort END IF @abort <> 0 BEGIN ROLLBACK TRAN END ELSE BEGIN COMMIT TRAN END IF @abort = 0 BEGIN EXEC proc_UpdateDiskUsed '1CA27B52-5021-4CE1-AE8A-C553F62481C5' END "


An unexpected error occurred while manipulating the navigational structure of this Web.


Leaving Monitored Scope (PortalSiteMapNode: Populating navigation children for web: /ABCDEF). Execution Time=66179.2079302278

PortalSiteMapProvider was unable to fetch children for node
at URL: /ABCDEF, message: An unexpected error occurred while manipulating the navigational structure of this Web., stack trace: 
 at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)  
 at Microsoft.SharePoint.Library.SPRequest.UpdateNavigationNode(String bstrUrl, Int32 lNodeId, DateTime dateParented, String bstrName, String bstrNodeUrl, Object& pvarProperties, String& pbstrDateModified)  
 at Microsoft.SharePoint.Navigation.SPNavigationNode.Update()  
 at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.UpdateSPNavigationNode(SPNavigationNode node, SPNavigationNode previous, String name, String url, String description, String target, String audience, Boolean forceCreate)  
 at Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode.UpgradeDraftSPNavigationNode(SPNavigationNode draftNode, SPNavigationNode previous)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.<>c__DisplayClass2.<UpdateNavigationNodes>b__0()  
 at Microsoft.Office.Server.Utilities.Security.SecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, Action secureCode)  
 at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.RunWithAllowUnsafeUpdates(SPWeb web, CodeToRun secureCode)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildrenInner(NodeTypes includedTypes)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildren(NodeTypes includedTypes)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, Boolean trimmingEnabled, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)   
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes)  
 at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode node, NodeTypes includedHiddenTypes) "



With  April 2013 CU or any of CU after April 2013 (Service Pack 2 .etc) it is now possible to fix this issue. You can download CU + sp2 from here

After you Install April 2013 CU or any of CU after April 2013 you will need to rum this code:

# Set the Problematic Site Collection
#-----------------------------------------------------
param($url = $(Read-Host -Prompt "SiteCollection Url"))      # Change the Value between the quotes

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


# Log Function
#--------------------
$Logfile = "C:\duplicates_log.txt"

Function LogWrite
{
   Param ([string]$logstring)

   Add-content $Logfile -value $logstring
}



# Utility Functions
#---------------------------
function tryDeleteNode
{
    param($node,$dictionary,$nodeCollection)

    $title = $node.Title
  
               
                    if(!$dictionary.ContainsKey($title))
                    {
                        $dictionary.Add($node.Title,$node.Url)
                    }
                    else
                    {
                        if($dictionary[$title] -eq $node.Url)
                        {
                            if($node.Children.Count -eq 0)
                            {
                                echo "       -> Deleting Duplicate Node: $title"
                                $nodeCollection.Delete($node)
                                $global:didDelete= $true
                                               $temp = (get-date).ToString() +";"+ ($site.Url) +";"+ ($title)
                                               echo "$temp"
                                               LogWrite $($temp)

                            }
                            else
                            {
                                echo "       -> Dupe Node $title has children, Skipping..."
                            }
                        }
                else
                        {
                    echo "       -> Duplicate title $title found, but mismatched link, Skipping..."
                        }
                    }
              
}


function deleteNodesRecurse
{
    $nodes = @{}
    foreach($node in $quickLaunch)
    {
        $childNodes = @{}
        foreach($child in $node.Children)
        {
            tryDeleteNode -node $child -dictionary $childNodes -nodeCollection $node.Children
        }

        tryDeleteNode -node $node -dictionary $nodes -nodeCollection $quickLaunch
    }
}


function deleteGlobalNodesRecurse
{
    $nodes = @{}
    foreach($node in $gnavNodes)
    {
        $childNodes = @{}
        foreach($child in $node.Children)
        {
            tryDeleteNode -node $child -dictionary $childNodes -nodeCollection $node.Children
        }

        tryDeleteNode -node $node -dictionary $nodes -nodeCollection $gnavNodes
    }
}


# The Program Start Here !
#-------------------------------------
$sitecoll = Get-SPSite $url
write-host "SiteCollection: " $sitecoll.URL -foregroundcolor Yellow
foreach ($site in $sitecoll.AllWebs)
{
        write-host " -> Site: " $site.URL -foregroundcolor Green
                do
                {
                               $quickLaunch = $site.Navigation.QuickLaunch
                               $global:didDelete = $false
                               deleteNodesRecurse
                               $pub= [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($site)
                               $gnavNodes = $pub.Navigation.GlobalNavigationNodes;
                               deleteGlobalNodesRecurse
                }
                while($global:didDelete)
                $site.Dispose()
}
$sitecoll.Dispose()

And that's it!, your Done.

Good Luck :)
Ron Ness.


No comments:

Post a Comment