Pages

September 20, 2014

List view with GroupBy error: Attempted to use an object that has ceased to exist


Error Scenario:
In SharePoint, when navigating to a list view page (ex: 'All Items' view), or to a site page (like home page) that contains a list view web part, the page crashes, throwing the following error:

Server Error in '/' Application.

Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED)) 


Debugging:
We know its something with list that causes the error, could be the view itself, or the columns or even something with the content types. The problem is that you cannot reach the list settings because 

1. Using PowerShell to get ID of the list and store it on text file:

$rrdbWeb = Get-SPWeb “http://{sitename}
$rrdbWeb.Lists[“{listname}”].ID > C:\ListID.txt

Example result: 522ba78b-f2e4-4335-b3e3-2a0ff6bb6d2e

 2. Manually construct list settings page url by adding the list ID as parameter to listedit.aspx page:

http://{sitename}/_layouts/listedit.aspx?List={522ba78b-f2e4-4335-b3e3-2a0ff6bb6d2e}

3.  Create new personal view 

4. Using PowerShell to get ID of the problematic view:

$rrdbWeb.Lists[“{listname}”].Views[“{viewname}’].ID > C:\ViewID.txt

Example result: c6a3293a-377d-4757-b5f3-26de78564f04

5. Remember to dispose objects you created  in PowerShell like $rrdpWeb when you finish

6. Manually construct the modify page for the problematic view, by adding List & View parameters to ViewEdit.aspx page:

http://{sitename}/_layouts/ViewEdit.aspx?List={522ba78b-f2e4-4335-b3e3-2a0ff6bb6d2e}&View={c6a3293a-377d-4757-b5f3-26de78564f04}

 Now have a look on all details of this view. 

7. Create Another view (I prefer personal one) & enter the exact same details from the our original view. The objective here is to be able to replicate and test the error. After playing with details, I found that GroupBy option is causing the error. When GroupBy is not used then view works perfectly well!


Root Cause:
The error is thrown because of the resource throttling in that list. The GroupBy is counting & folding too many items causing SharePoint to prevent the SQL server from processing the view query. When checking the number of items in list settings page, it shows it had 18670 items (way above the default list view threshold of 5000).


Solution:
The fix is to enable larger resource throttling for the target web application.
Example: In this case I set to 20000.

From Central Administration site > Manage Web Applications > select target web app > General Settings > Resource Throttling > change List View Threshold > OK

Note: there is a reason of why Microsoft set the default theshold into 5000 which is to avoid getting a performance hit on SQL server by queries on too many items. When you have very large lists or libraries, try to think about alternative approaches to divide the data, such as split into multiple lists, or using folders in case of document libraries.





No comments:

Post a Comment