Recently I had the problem that random clients crashed in different parts of the application.

The following error message was shown:

Communication error:The server needs to free resources. Your session has been terminated.

In the application event log on the AOS server warnings with the event ID 180 were logged:

Object Server 01: RPC error: Client provived an invalid session ID xx

In other instances users get error messages

"Error executing code: Insufficient memory to run script.".
The system becomes unusable after a while; only a restart of the AOS service resolves the problem temporarily. The following two event log entries appear frequently and normally together at the same time:

Dialog issued for client-less session 1: The upper limit of open cursors for Microsoft Dynamics has been exceeded (90). Use the -OPENCURSORS parameter, or modify the X++ code.

RPC error: Exception 3221225495 occurred in session 1

Increasing the number of open cursors doesn't make a difference.

In all these cases it has always been identified that too high values in the AOS Configuration on the Database Tuning tab is specified. For example in one instance we had:

  • Array Fetch Ahead was set to 1
  • Maximum open cursors was set to 500
  • Max Buffer size was set to 100

These parameters should not be changed unless there is a real need behind it.
My experience shows me that changing these parameters can lead to AOS stability problems.

Finally we could solve the problem by just setting back the parameters to the default values (blank) which are:

  • Array Fetch Ahead: 100
  • Maximum open cursors: 90
  • Maximum Buffer size: 24 (KB)

It is quite common to increase the maximum buffer size, however the value specified needs to be in Kilobytes (e.g 28) and not bytes (28000), and it is often seen as the root cause of most AOS instability issues as we find the values are specified in thousands.

Please find additional information here: http://msdn.microsoft.com/en-us/library/aa569634(AX.10).aspx

If the maximum buffer size values are specified as the default or within a small increase, and yet you get the error "Error executing code: Insufficient memory to run script." then review tis link for other causes and solutions.