I am wondering if Joseph Tews is a mind reader, or if he can somehow see my draft blog posts before they are published. Joking aside, it turns out that the same day he posted about Symantec Endpoint Protection, he also posted about this topic that I was planning to post about. Unless he has a super power, then I will have to believe that these issues are faced by enough people to warrant multiple blog posts.
The issue for this post is one that almost everyone has seen at some time. Microsoft Dynamics GP or Microsoft Dynamics GP Utilities showing as Not Responding and maybe even receiving a dialog from the operating system offering to close the application forcibly. This is especially common when using Dynamics Utilities to create or upgrade databases.
So, I wanted to discuss what causes the "Not Responding" state and what actions should be taken when it occurs.
NOTE: If you terminate the application while it is still busy working and manipulating SQL data, you could cause data corruption and be required to restore a backup of the data.
In simple terms, whenever you swap focus to another application or move a window around to cover or expose another application, the Windows operating system sends a request to all the applications involved to redraw their screens. If this does not happen within a short period of time, then Windows marks the application as Not Responding and will pop up a dialog offering to close the program.
The question here is .... Even if Microsoft Dynamics GP is not responding, has it stopped working? Usually, the answer is No.
The Dexterity runtime engine (on which Microsoft Dynamics GP runs) only updates the screens when control is returned to the user interface or when updating the user interface, so if the application is busy processing Dexterity code or busy waiting for SQL Server processing to complete and there is no changes to display on the screen, it will not redraw the screen and appear to Windows to be Not Responding. The truth is that the application is just too busy to update its screen and Windows (especially the newer versions) is just being impatient.
To get a little more technical, here is an explanation from my fellow Escalation Engineer, Aaron Donat:
The Dexterity runtime will usually have two or more connections to the SQL Server per client instance; which to Microsoft Dynamics GP is considered a foreground and background connection. When either a foreground or background process is executed by the Dynamics GP Client, those connections are invoked through the Dexterity runtime. When this occurs, the Dexterity runtime engine can end up in a “waiting state” for as long as the external process takes to complete and return. During this waiting period, the OS level “pings” from the Dexterity runtime will eventually stop functioning at given specific threshold. Once the OS level pings cease, the operating system takes and marks the application as “Not Responding” because of the lack of response between the two applications. This threshold is more clearly defined and pronounced on Windows 7 / Server 2008 operating systems than on Windows XP / Server 2003. In addition, the cause for this issue doesn’t specifically have to be a SQL connection that isn’t responding. Other cases could be large calculations, lack of hardware resource, a business logic issue within the application, an external application such as a Web Browser or Office Application using shared resources and anti-viruses.
As soon as it has completed what it is working on or has an update for the screen, it will redraw its window.
So, how can I tell that Microsoft Dynamics GP is still running and that I should just "Wait for the program to respond".
There are five possible situations:
- The application is running Dexterity code that does not access SQL data and just needs time to finish.
- The application is running Dexterity code that does access SQL data and just needs time to finish.
- The application is running Dexterity code that does not access SQL data and has entered an infinite loop.
- The application is running Dexterity code that does access SQL data and has entered an infinite loop.
- The application has frozen and is no longer processing.
For situations 1 and 3, it will be difficult to tell whether time will fix the problem. You can watch the CPU usage in the Task Manager and see if it fluctuates (still working) or is maxed out (probably looping). Fortunately, most activities in the application do involve some access of SQL data, and these situations are rare.
For situations 2 and 4, you can check if SQL Server is processing, you can use the Activity Monitor to see an overview of the activity that SQL Server is doing or you can start a SQL Profile Trace to watch the actually commands being executed.
For the SQL Profile Trace approach, start the SQL Server Profiler from the Tools menu. Connect to SQL Server and use the Events Selection tab to make sure the following events are selected. You might need to check the Show all events checkbox:
- TSQL: SQL:StmtCompleted
- TSQL: SQL:StmtStarting
For more information on how to use the SQL Server Profiler, see the MSDN articles below:
- MSDN: How to: Create a Trace (SQL Server Profiler)
- MSDN: How to: Specify Events for a Trace File (SQL Server Profiler)
Situation 4 can be identified with the SQL Profile trace, when the logged events keep repeating without changing the records they are working on.
For situation 5, you will see no activity at the SQL Server level and probably no CPU usage in the Task Manager. In this case, you only course of action would be to forcibly close the application using Task Manager.
If you do have to forcibly close the application at anytime, you would be safest to restore a backup, or at least closely check the data that was being touched to ensure there is no data corruption.
Also check out this post form the Dynamics GP Support and Services Blog:
Hope this information is helpful.
13-Sep-2012: Added Link to post by Chris Bulson.