How to Fix SSRS Timeouts in AX 2012 the Right Way

How to Fix SSRS Timeouts in AX 2012 the Right Way

This blog is about SSRS timeouts and how to fix them in the right way

Reporting in Microsoft Dynamics AX 2012 has been updated from previous versions of Dynamics AX. Where we used to use MorphX reports in AX 2009 and earlier versions, the entire AX 2012 reporting solution has been migrated to SQL Server Reporting Services. Reporting SSRS timeouts can cause lots of frustration for users and impact critical business processes such as month-end, year-end, etc.

In this blog post we will discuss the causes of timeouts in AX 2012 SQL Server Reporting Services (SSRS) reports. The intended audience of this blog post are Dynamics AX developers and other technical professionals. If you are seeing errors like this, read on to discover some common ways to fix reporting timeout issues in AX 2012!

Microsoft Dynamics AX 2012 Timeout Error

Figure 1 SSRS Timeouts in AX 2012

We have separated this blog post into two main sections:

  • Timeout Troubleshooting
  • Timeout Settings

Timeout Troubleshooting

SSRS report timeouts in AX 2012 are often caused by inefficient code/query design in AX. To identify where the bottleneck is, we need to debug and explore the SSRS logs.

Debugging

Before we get started, you need to make sure you have the right components to debug.

To debug Report Data Provider (RDP) classes, you must be on the Application Object Server (AOS) machine and that same machine must have the SSRS instance installed. Also the AOS must be setup for debugging.

Microsoft Dynamics AX Server Configuration Utility

Figure 2 – SSRS Timeouts in Microsoft Dynamics AX 2012

SSRS reports in AX can get data from one (or more) places:

  • AX query
  • AX Report Data Provider
  • An outside data source

Debugging a Query can be tough, as it simply pulls data from the AX database from an AX query object in the Application Object Tree. See the section below on query optimization for techniques on improving query performance.

To debug a report based on an RDP, set a breakpoint in that report’s processReport method.

Microsoft Dynamics SSR timeout - AX RDP

Figure 3 – SSRS Timeouts in Microsoft Dynamics AX 2012

Observe the behavior of the RDP class using the same parameters as your report users to see where your bottlenecks are.

SSRS Logs

You can view the logs on the SSRS server to get more details on a timed out report. The logs can be found on the SSRS Server at \Program Files\Microsoft SQL Server\MSRS10.<Instance Name>\Reporting Services\LogFiles.

Reviewing SSRS logs will provide more information than AX infolog dialogs in many cases.

Microsoft Dynamics AX SSRS Logs

Figure 4 – SSRS Timeouts in Microsoft Dynamics AX 2012

If the log doesn’t provide enough information, you can increase the DefaultTraceSwitch setting in the ReportingServicesService.exe.config file. The file can be found at \Program Files\Microsoft SQL Server\MSRS10.<Instance Name>\Reporting Services\ReportServer\bin.

Microsoft Dynamics AX Reportingservicesservice

Figure 5 – SSRS Timeouts in Microsoft Dynamics AX 2012

SSRS Timeout Solutions

Once we have identified the error, sometimes we need a little help planning our attack on improving report runtimes. We have provided some common solutions to long running reports here.

Note that these code improvements will only have effect on large data sets. Make sure you know the source of your timeouts before taking the time to redesign code.

Code Review

We all make mistakes. Perhaps the developer who wrote the RDP class made a mistake or the data processing requirements of the report have changed.

Code Review: Query

If a query takes a long time to run, see if you can make it run more efficiently.

Common areas of improvement are:

  • Inner joins vs. exist joins
  • Dynamic field property set to Yes

If the business requirement is to see if a record exists, we can accomplish this through an inner join. However, when we do this we may be pulling unnecessary amounts of data into AX.

For example, the business requirement in the query below is to give all purchase order lines where the vendor’s vendor group has a payment term of 30 days. The join to the VendGroup table is only to filter the results, no VendGroup fields are required in the report.

Microsoft Dynamics AX VendGroup

Figure 6 – SSRS Timeouts in Microsoft Dynamics AX 2012

This query is making two mistakes; the query does not need to perform an inner join and it doesn’t need to pull all the fields for the VendGroup table.

Microsoft Dynamics AX VendGroup 2

Figure 7 – SSRS Timeouts in Microsoft Dynamics AX 2012

Here we have set the JoinMode property of the VendGroup node to ‘ExistsJoin’ and removed all of the unnecessary fields from the VendGroup node.

Now when the query runs, it will run faster due to the reduced amount of data requested from the Dynamics AX database.

Code Review: RDP Class

If an RDP class is written in an inefficient way, it can greatly impact report running times. Here we will provide an example of an RDP class that can be refactored to improve report performance.

For example, say we have a very simple business requirement to pull the number of invoices that a given vendor has had in a report.

In the code segment below, an extra SQL call is made for each vendor in the report.

Microsoft Dynamics AX RDP Class 1

Figure 8 – SSRS Timeouts in Microsoft Dynamics AX 2012

We can optimize this report by having all the invoice counts done during the initial report query.

In the resulting RDP class, we only make one call to SQL to get the total number of invoices for each vendor. This reduces network traffic, causes the report to run more quickly, and reduces the number of calls to the SQL server during report execution.

Microsoft Dynamics AX RDP Class 2

Figure 9 – SSRS Timeouts in Microsoft Dynamics AX 2012

Special Case: Dynamics AX Kernel Code

This scenario is a *last resort* for troubleshooting. Once you have exhausted query/RDP re-design as well as AX/SSRS settings you will most likely need to submit a support request with Microsoft. You can contact your Partner to do this and they will contact Microsoft on your behalf to resolve the issue.

To give an example of this type of scenario, myself and my team had a customer that was printing check runs of 1,000+ checks. The customer was running AX 2012 R2 CU 7. This is not terribly uncommon and AX should be able to handle these types of reporting scenarios. To add to the complexity, the ChequeDP RDP class and SSRS report (along with accompanying C# code) was heavily customized by a previous Partner and we had no documentation. To resolve the issue we tried the following:

  • We re-designed the ChequeDP class to extend the SrsReportDataProviderPreProcess
  • We increased timeouts in the Reporting Services AXC file as well as an isolated AX Client AXC file
  • We increased timeouts in the Production instance of SSRS
  • We increased timeouts in the Ax32Serv.exe.config file for the AOS handling reporting requests

Even after increasing all available timeouts to over an hour, the report was timing out against the SSRS instance after approximately an hour. Nothing seemed to work and we reached out to Microsoft. After troubleshooting it turned out to be an Dynamics AX Kernel issue. As a Partner we do not have visibility into the AX Kernel code. Microsoft provided a (at the time unpublished) hotfix. We are providing the KB number and title here for reference purposes. If you are seeing timeouts after implementing the suggestions in this blog post and are running AX 2012 R2 CU7 (we cannot attest to other versions of Dynamics AX 2012) you may want to reach out to Microsoft to resolve this issue and/or log into your Life Cycle Services account to download the latest hotfix for this issue.

KB 2936794 – Printing reports to printer is failing without timeout error for larger reports

SSRS Timeout Settings

Now that we’ve explored timeout troubleshooting, let’s take a look at the settings that can affect report timeouts.

Be careful of “Just increase the timeouts!”

Before we start, when running into timeouts in SSRS a common answer is, “Just increase the timeouts!” This kind of thinking is commonly a band-aid for poor report design. If you must increase timeouts as a troubleshooting measure, remember to set them back to previous levels after finding out why your reports are timing out! Long timeouts can cause the [ReportServer]TempDb database on the SSRS database server to grow very large when many users have open sessions (among other challenges).

SSRS Settings

Below are some common SSRS settings you can extend as your troubleshoot long running reports.

Report Execution Timeout: Site Level

To extend this timeout, open the SSRS Home Page and navigate to the Site Settings page (top right).

The default timeout is 30 minutes (1800 seconds).

SQL Server Reporting Services Site Settings

Figure 10 – SSRS Timeouts in Microsoft Dynamics AX 2012

Report Execution Timeout: Report Level

By default, all reports use the Site level Report Timeout value. However, you can change the Report Timeout setting on a per-report basis.

SQL Server Reporting Services Dynamics AX

Figure 11 – SSRS Timeouts in Microsoft Dynamics AX 2012

SQL Server Reporting Services Site Settings Report Timeout

Figure 11 – SSRS Timeouts in Microsoft Dynamics AX 2012

SessionTimeout & SessionAccessTimeout

The SQL Server instance has two settings that may cause timeouts if the user session used to render SSRS reports takes too long.

The SessionTimeout and SessionAccessTimeout settings are in seconds.

By default, the SessionAccessTimeout setting is not visible in the SSRS settings. You can view them in SQL Server Management Studio by connecting to the SSRS instance and viewing the Properties of the instance.

SQL Server Management Studio Settings

Figure 12 – SSRS Timeouts in Microsoft Dynamics AX 2012

SQL Server Management Studio Settings 2

Figure 13 – SSRS Timeouts in Microsoft Dynamics AX 2012

To change the SessionAccessTimeout setting for the first time, you must run a script against rs.exe. This executable is typically located in \Program Files\Microsoft SQL Server\110\Tools\Binn (SQL 2008) or \Program Files (x86)\Microsoft SQL Server\120\Tools\Binn (SQL 2012).

Create a text file the following and save it with the .rss extension.

Public Sub Main()
Dim props() as [Property]
props = new [Property] () { new [Property](), new [Property]() }

props(0).Name = "SessionTimeout"
props(0).Value = timeout

props(1).Name = "SessionAccessTimeout"
props(1).Value = timeout

rs.SetSystemProperties(props)
End Sub

Now you can run the following command against rs.exe to update the timeout settings.

"C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\rs.exe" -i c:\temp\extendTimeouts.rss -s http://localhost/reportserver -v timeout="6000"

This example will set both user session timeouts to approximately an hour and a half.

Microsoft Dynamics AX CMD Timeout

For future changes to these timeouts, you can change them from the SQL Server Management Studio.

Microsoft Dynamics Server Properties

Figure 15 – SSRS Timeouts in Microsoft Dynamics AX 2012 – Server properties

Microsoft Dynamics AX Settings

Since SSRS uses the AX Query Service, we may run into timeout issues due to these settings.

Microsoft Dynamics AX Settings: Server-side

We can make changes to the WCF thresholds in the AX32Serv.config. This file is typically located at \Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin on the AOS server.

Since the Query Service sends data to SSRS when requested, we can increase the sendTimeout attribute of the binding element with the QueryServiceBinding name attribute to handle requests that take longer than the default 10 minutes.

Microsoft Dynamics AX Settings Server Side

Figure 16 – SSRS Timeouts in Microsoft Dynamics AX 2012

Microsoft AX Settings: SSRS Host

The AX Reporting Extensions use the Business Connector settings for the AX Client installed on the SSRS host computer. Alternatively, SSRS can use an AXC file placed in \ReportServer\bin directory of the SSRS instance. View Create a new Microsoft Dynamics AX configuration [AX 2012] if you have this sort of configuration as you will need to edit that AXC file instead of the Business Connector configuration. These instructions are for a Business Connector configuration that is saved in the registry.

On the SSRS host server, open the Dynamics AX 2012 Configuration Utility as an Administrator (otherwise your changes may not be saved due to User Account Control) and navigate to the Business Connector configuration.

Microsoft Dynamics AX Configuration Utility 1

Figure 17 – SSRS Timeouts in Microsoft Dynamics AX 2012 – Configuration Utility

If there are no configurations other than the Original (installed configuration) create a new one.

Microsoft Dynamics AX Configuration Utility 2

Figure 18 – SSRS Timeouts in Microsoft Dynamics AX 2012 – configuration utility

Open Configure Services and acknowledge your settings will overwrite the default WCF settings.

Microsoft Dynamics AX Configuration Utility 3

Figure 19 – SSRS Timeouts in Microsoft Dynamics AX 2012

If you see this message, you can download and install the Windows SDK for your version of Windows Server and the SDK for .NET Framework 4.0. But this is not required.

Microsoft Dynamics AX Configuration Utility 4

Figure 20 – SSRS Timeouts in Microsoft Dynamics AX 2012

If you do not have the Windows SDKs installed, you will be presented with a text file. Search for QueryServiceEndpoint and increase the sendTimeout and maxReceivedMessageSize attributes of the binding element with the QueryServiceEndpoint name attribute.

When troubleshooting, we typically increase sendTimeout to 00:20:00 (20 minutes) and maxReceivedMessageSize to 4294967294 (twice as big).

Microsoft Dynamics AX Text File sendtimeout

Figure 21 – SSRS Timeouts in Microsoft Dynamics AX 2012

We hope you liked the blog post! If your have ideas for Microsoft Dynamics blogs feel free to suggest topics of interests.

Avantiico has delivered many presentations at Dynamics user group events and webinars. If you want to learn more about SSRS timeouts and how you can move from your current Microsoft Dynamics AX version to Microsoft Dynamics 365.

If you have any questions about Microsoft Dynamics Support for Dynamics AX or Dynamics 365, Product Lifecycle, SSRS or if we can help your team with information about the new Microsoft Dynamics 365 please contact our Microsoft Support team at DynamicsSupport@Avantiico.com.

In the next 6 to 12 months you will see many Microsoft news so stay informed by following Avantiico on LinkedIn and YouTube:

About Aaron Emde

Aaron Emde has created 2 entries.

3 Comments

  • roshani

    @Aaron,
    That’s really a detailed and great article.. i appreciate your efforts and wish you with keep rising in learning and spreading knowledge

    • Molo

      Thank you very much.

      We recommend all our connections to follow us on YouTube or LinkedIn where we will be posting a lot of new material related do Microsoft Dynamics D365 – check it out YouTube or LinkedIn

      Regards,
      Team Avantiico

Post A Comment

YOUR CAPTCHA HERE

Contact Us

All fields required

First name

Last name

Company

Your Email

Subject

Your Message

×

Meet Us

All fields required

First name

Last name

Company

Your Email

Available Date & Time
AMPM

Your Message

×

Subscribe to our mailing list

* indicates required
 

×
Learn More

Contact Us

All fields required

First name

Last name

Company

Your Email

Subject

Your Message

×

CRM Test Form

×

Influence

All fields required

First name

Last name

Company

Your Email

Proposed Webinar Date & Time
AMPM

Your Message

×

Contact Us

All fields required
×

Contact Us Here! 

* indicates required

×

We want to hear your feedback

∗ indicates required

×

Let us keep you updated!

 ∗ indicates required

×

Meet Us

All fields required

First name

Last name

Company

Your Email

Available Date & Time
AMPM

Your Message

×

Contact Us Here! 

* indicates required

×

Contact Us Here! 

* indicates required

×

Schedule your meeting with us!

* indicates required

×

Schedule your meeting with us!

* indicates required

×

Book Your Time

×

                        RAMPUP SUBSCRIPTION PLANS

                    Choose a plan below, and one of our

              Support Consultants will contact you shortly.

×

                           PACKAGES START AT $4,999

                  Choose a package below, and one of our 

               Support Consultants will contact you shortly.

×

 Performance Review Details

 

Diagnostic Review of DyanmicsAX Server (AOS) & SQL performance and stability.

 

Written summary of findings and recommendations.

 

Up to 15 hours of issue resolution time to target your most immediate performance issues.

 

Review completed by our 100% onshore support team averaging more than 10+ years of DynamicsAX experience.

 

Get the help you need now, with no long-term commitment.

×

Functional/Department Help Pick 3

 

Help with up to 3 functional or department issues such as: invoicing, costing, closing the books, AR, AP, inventory, warehousing, etc.

 

Talk with our 100% onshore functional experts with over 250+ years of combined AX experience to define your issues and find recommended solutions.

 

Up to 20 additional hours of issue resolution time included.

 

Presentation of solutions and next steps from our expert team.

 

Get the help you need now, with no long-term commitment.

 

×

Reporting / BI Help

 

Choose up to 3 standard or custom reports for assistance.

 

Solve typical issues like: Report too slow, does not show what we need, need an additional field/column, etc.

 

Talk with our 100% onshore functional experts with over 250+ years of combined AX experience to troubleshoot report issues and recommend solutions.

 

Up to 20 additional hours of configuration or development time included.

 

Presentation of solutions and next steps from our expert team.

 

Get the help you need now, with no long-term commitment.

×

Please fill in the form to RSVP

 

×