Have you ever wondered why your report processing prematurely terminated? Or While you execute a SSRS web service API call, suddenly you see it failing without any proper information?

For today’s discussion, I’m taking an example where I upload a report using ReportService2010's CreateCatalogItem. While the code is executing you either see a brief pause where the application seems to be hung or it just fails with a Thread abort exception,

Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.Threading.ThreadAbortException: Thread was being aborted.

You decide to take a look at the reporting service log file. Ensure you have enabled Verbose logging in your report server instance by following the article,

http://msdn.microsoft.com/en-us/library/ms156500.aspx or using the tool that I developed that can be downloaded from,

http://verboselogger.codeplex.com/

During the failure time frame the log file just shows the following,

processing!ReportServer_0-1!928!05/10/2012-16:58:34:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.Threading.ThreadAbortException: Thread was being aborted.

runningrequests!ReportServer_0-5!94c!05/10/2012-17:37:07:: v VERBOSE: SoapAction: "http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCatalogItem"
webserver!ReportServer_0-5!91c!05/10/2012-17:37:07:: i INFO: Reporting Web Server stopped
rshost!rshost!94c!05/10/2012-17:37:10:: w WARN: SID Type was not SidTypeUser. (122)
rshost!rshost!728!05/10/2012-17:37:10:: v VERBOSE: HttpPipeline::DisconnectCallback: releasing pipeline=0x000000000083FE10.
rshost!rshost!94c!05/10/2012-17:37:10:: v VERBOSE: HttpPipelineCallback::EndOfRequest(): releasing pipeline=0x000000000083FE10.
rshost!rshost!94c!05/10/2012-17:37:10:: v VERBOSE: HttpPipeline::ReleaseOnce: releasing pipeline=0x000000000083FE10.
httpruntime!ReportServer_0-5!94c!05/10/2012-17:37:10:: e ERROR: Failed to process request, pipeline=0x83FE10:
rshost!rshost!94c!05/10/2012-17:37:10:: v VERBOSE: HttpPipeline::DoStateProcess failed with hr=0x80131014, pipeline=0x000000000083FE10.
appdomainmanager!DefaultDomain!94c!05/10/2012-17:37:10:: i INFO: Appdomain:3 ReportServer_MSSQLSERVER_0-1-129811569875140647 unregistered.

Well this is what the log file says, Reporting service failed to process request due to an appdomain unregister event.

Though it gives a hint that the processing failed because of the appdomain unload it didn’t give any reason why reporting service process unloaded the app domain.

So all you have to do now is, start scanning the log file upwards from the point of failure. Or another easier option is to search the file for keyword, “appdomainmanager”. This will actually help you to quickly scan the events logged by the App domain manager.

Coming back to scanning the log file, suddenly you would see messages like below,

appdomainmanager!ReportServer_0-1!91c!05/10/2012-16:58:22:: v VERBOSE: Appdomain:3 ReportServer_MSSQLSERVER_0-1-129811569875140647 is about to be unloaded. ShutDownMessage: Change Notification for critical directories.
bin dir change or directory rename
HostingEnvironment initiated shutdown
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename
Change Notification for critical directories.
bin dir change or directory rename

Yes, this is the reality. App domain manager says, Change in critical directories has triggered the app domain unloading.

A little bit of research revealed the following,

Here critical directory refers to the <%Installation Directory%\Program Files\Microsoft SQL Server\MSRS10_50.SQL2K8R2\Reporting Services\ReportServer\bin location. (Hint is which app domain is getting unregistered. If it is Report manager then you need to refer the bin directory under ReportManager folder).

So all I did was, ran the application again and just copied a .txt file to the above location. That immediately triggered the app domain unload and ended up terminating all the activities that are currently executing in those app domains. That explains why my report server prematurely terminated its activity.

In a nut shell, if you’ve an application (or manually) that does some custom assembly / resource file deployment followed by reports deployment, then ensure you do a report server service restart between them so that any activity followed by assembly / resource deployment doesn’t fail.

The above scenario is just one sample which I discussed. App domain will get unloaded for other numerous reasons as well. But you need to ensure what triggered it by carefully scanning the log file and correlating the events that you find in the log file during the failure time frame.

Hope this helps!

Selva.
[All the posts are AS-IS and doesn’t carry any warranty]