Sharepoint 2010: Unable to Display This Web Part. Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.

I have got a live testing version of a SharePoint 2010 based room & reservations bookings template (which I promise I will one day finish!).

Randomly, users were getting an error on their screens though.

Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID:40dd096d-a486-44ed-8f27-af1d31530213.

The Correlation ID here, when looked up in the log files (c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\) takes me to a 4 line description which starts:

Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.

It turns out, that since the August 2011 Cumulative Update for SharePoint 2010, there is a timeout put on XSLT Transforms. My page in particular uses these transforms to draw the timeline of what rooms are available when. As far as I know this only affects DataViewWebParts.

In order to overcome this, after installing the February 2012 Cumulative Update for SharePoint 2010 you can configure this timeout period. This can be done by running the following commands at the SharePoint PowerShell prompt.

$myfarm = Get-SPFarm
$myfarm.XSLTTransformTimeout = 5
$myfarm.Update()

The page now appears correctly for everyone!

Note: The brackets at the end of the Update() line are essential. If you don’t put them in then the changes you make will not save. If you want to check that your change has been saved then enter the following two commands, and your new timeout will be shown.

$testfarm = Get-SPFarm
$testfarm.XSLTTransformTimeout

If you have particularly complex and involved XSLT then you may need to increase the timeout further. For the application that I was working on, 2 seconds worked for all users except for 1 time. We set it as 5 as a fail safe, as generally people will be happier with it working and waiting an extra second. If you go too high though, then you may be compromising the users experience, and should probably look at optimising your code, or creating a sub-class for the code as per the Microsoft KB: http://support.microsoft.com/kb/2639184

10 people found this post useful.


12 thoughts on “Sharepoint 2010: Unable to Display This Web Part. Error while executing web part: System.StackOverflowException: Operation caused a stack overflow.

  1. Hi. I am a complete newbie to SharePoint and server administration in general. I opened up SharePoint Management Shell and entered in the second command to see what the current timeout was set at. I got nothing. In fact, I have attempted to enter a variety of commands and always get nothing. Is this because I am not running the shell as administrator? I would appreciate any assistance. I get a stalemate too frequently and it is frustrating. Time to start asking some questions! :)

    1. Hi, no worries in asking questions! I have to be honest that I always have ran the SharePoint Management Shell as an administrator – so I’m not sure if it does anything different when run as a standard user – bad practice I know :-) I should be able to get in front of a SharePoint environment on Friday and test though (my home trial setup has expired). Any chance you can run as admin and let us know how you get on?

  2. Thanks a lot. We had this problem rendering the Webparts on the People Searchpage. Solved all our troubles. :-)

  3. hi.. i wanted check the time out. checked in many servers,(3)
    but i m getting null. below is powershell.. how to check how much time out is there at present?
    $testfarm = Get-SPFarm
    $aa = $testfarm.XsltTransformTimeOut
    if($aa -eq $null) {Write-Host its nul}
    else { Write-Host $aa }

    1. To look at the currently set time:

      $myfarm = Get-SPFarm
      $myfarm.XSLTTransformTimeout

      Should return the value on a new line. If you want you could then pipe this to a variable for later manipulation or comparison.

      1. Hi,
        Sorry to be posting on an old thread.

        I have tried running this script to get the currently set time on the frontend server and powershell does not return a value. It just goes back to the promt.

        Any help it greatly appreciated.
        Thanks,
        Derek

        1. Hi, from memory, the update command does not return a value and does just go back to the prompt.

          The second command should return you an integer value though if you want to verify that your command has worked.

        2. You probably don’t have February 2012 Cumulative Update for SharePoint 2010 installed ;)

          1. I’m fairly certain I did at the time, but I have no idea now! The system has been decommissioned now.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.