Invalid state for read: Current state = STATE_ALLOCATED - Forum - OpenEdge Development - Progress Community

Invalid state for read: Current state = STATE_ALLOCATED

 Forum

Invalid state for read: Current state = STATE_ALLOCATED

This question is answered

We are doing some load-testing using .Net against PASOE.  The PASOE instance runs on windows with OE 11.7.4 .  Our .Net proxies are generated using 11.6.3 (file version of Progress.o4glrt.dll is 11.6.0.1408).

The load-testing involves running a bunch of SSRS reports.  Internally they use the OpenClient proxies, and are failing with Open4GLExceptions; we get an enormous number of failures that look like so:

processing!WindowsService_1!136c!12/21/2018-14:33:39:: e ERROR: An exception has occurred in data set 'Whatever'. Details: 
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'Whatever'. --->
Progress.Open4GL.Exceptions.Open4GLException: Communication layer message: Invalid state for read: Current state = STATE_ALLOCATED (7249) . (7175)

This is happening on the openclient side of things, not on the server.  I haven't seen any errors yet on the PASOE server side.  There doesn't appear to be any "good" reason for failures.  I'm thinking there is some sort of concurrency issue when using more than one openclient connection on several threads at the same time.

I found a KB article, but it seems no more useful than the error message itself.

https://knowledgebase.progress.com/articles/Article/How-to-trouble-shoot-an-Invalid-state-for-read-Current-state-STATE-ALLOCATED-7249

Is anyone familiar with this error?  I'm hoping that whoever created the KB might be able to contribute more information.  It seems like the KB describes the process of getting half-way to a solution, but doesn't provide any meaningful conclusions.

The amount of load that we are placing on PASOE is not unreasonable, and there don't appear to be any "good" reasons for the error messages.

I will probably be spending a lot of time at this, but was hoping someone might give me tips or point me in the right direction.  Any help would be appreciated.

Verified Answer
  • I think I got to the root cause of the STATE_ALLOCATED errors in the .Net openclient.  It appears to have been related to one of the static properties that impact HTTP connections to PASOE.  Below are two methods that may be called to adjust the static properties.  The first, SetStaticServicePointManagerProperties(), is going to adjust the ServicePointManager in the .Net framework itself.

    The second, SetStaticOpenClientRunTimeProperties(), is a Progress thing.  I think this is documented in the KB somewhere.  You will notice below that Progress has an HTTP timeout that is used for PASOE requests via the openclient proxies.

            /// <summary>
            /// Static values used for HTTP web request clients.
            /// </summary>
            public static void SetStaticServicePointManagerProperties(
                int p_DefaultConnectionLimit = 100,
                bool p_UseNagleAlgorithm = false,
                bool p_UnlimitedServicePoints = true,
                int p_MaxServicePoints = 1000)
            {
                // Default limit should be at least 10
                System.Net.ServicePointManager.DefaultConnectionLimit = p_DefaultConnectionLimit;
    
    
                // Whether to use nagle (delayed packet transmission)
                System.Net.ServicePointManager.UseNagleAlgorithm = p_UseNagleAlgorithm;
    
    
                // Optional limit on service points
                if (p_UnlimitedServicePoints)
                {
                    // 0 means there is no limit to the number of System.Net.ServicePoint objects.
                    System.Net.ServicePointManager.MaxServicePoints = 0;
                }
                else
                {
                    // Specify the maximum
                    System.Net.ServicePointManager.MaxServicePoints = p_MaxServicePoints;
                }
            }
    
            /// <summary>
            /// Set the open client runtime properties.
            /// At this time the only change we are making is to the HttpTimeout used for PASOE.
            /// </summary>
            /// <param name="p_HttpTimeoutSeconds">Default to time out after 30 mins.</param>
            public static void SetStaticOpenClientRunTimeProperties(
                int p_HttpTimeoutSeconds = 1800)
            {
                // Warning! This throws a lot of 
                // ridiculous first-chance exceptions during
                // the RunTimeProperties static ctor.
                RunTimeProperties.SetIntProperty(
                    IPoolProps_Fields.HTTP_TIMEOUT, 
                    p_HttpTimeoutSeconds);
            }

    Hope this helps anyone else running into STATE_ALLOCATED errors.    There are a couple Progress KB's about those errors, but they didn't point me to any solutions.  

All Replies
  • I think I got to the root cause of the STATE_ALLOCATED errors in the .Net openclient.  It appears to have been related to one of the static properties that impact HTTP connections to PASOE.  Below are two methods that may be called to adjust the static properties.  The first, SetStaticServicePointManagerProperties(), is going to adjust the ServicePointManager in the .Net framework itself.

    The second, SetStaticOpenClientRunTimeProperties(), is a Progress thing.  I think this is documented in the KB somewhere.  You will notice below that Progress has an HTTP timeout that is used for PASOE requests via the openclient proxies.

            /// <summary>
            /// Static values used for HTTP web request clients.
            /// </summary>
            public static void SetStaticServicePointManagerProperties(
                int p_DefaultConnectionLimit = 100,
                bool p_UseNagleAlgorithm = false,
                bool p_UnlimitedServicePoints = true,
                int p_MaxServicePoints = 1000)
            {
                // Default limit should be at least 10
                System.Net.ServicePointManager.DefaultConnectionLimit = p_DefaultConnectionLimit;
    
    
                // Whether to use nagle (delayed packet transmission)
                System.Net.ServicePointManager.UseNagleAlgorithm = p_UseNagleAlgorithm;
    
    
                // Optional limit on service points
                if (p_UnlimitedServicePoints)
                {
                    // 0 means there is no limit to the number of System.Net.ServicePoint objects.
                    System.Net.ServicePointManager.MaxServicePoints = 0;
                }
                else
                {
                    // Specify the maximum
                    System.Net.ServicePointManager.MaxServicePoints = p_MaxServicePoints;
                }
            }
    
            /// <summary>
            /// Set the open client runtime properties.
            /// At this time the only change we are making is to the HttpTimeout used for PASOE.
            /// </summary>
            /// <param name="p_HttpTimeoutSeconds">Default to time out after 30 mins.</param>
            public static void SetStaticOpenClientRunTimeProperties(
                int p_HttpTimeoutSeconds = 1800)
            {
                // Warning! This throws a lot of 
                // ridiculous first-chance exceptions during
                // the RunTimeProperties static ctor.
                RunTimeProperties.SetIntProperty(
                    IPoolProps_Fields.HTTP_TIMEOUT, 
                    p_HttpTimeoutSeconds);
            }

    Hope this helps anyone else running into STATE_ALLOCATED errors.    There are a couple Progress KB's about those errors, but they didn't point me to any solutions.