Feedback
Did this article resolve your question/issue?

   

Article

Connected( ) Behavior in PAS for OpenEdge

« Go Back

Information

 
TitleConnected( ) Behavior in PAS for OpenEdge
URL Nameconnected-behavior-in-pas-for-openedge
Article Number000205808
EnvironmentProduct: OpenEdge
Version: 11.5.x, 11.6.x, 11.7.x, 12.x
OS: All Supported Platforms
Question/Problem Description
How does the CONNECTED() method work when used on a handle connected to a PASOE agent?
Why does the CONNECTED method return TRUE when PASOE agent is down?
How to check whether application is still connected to a PASOE agent?
 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution

Connected( ) Behavior in PAS for OpenEdge

Connected() is a method on the server object handle that returns TRUE if a PAS for OpenEdge instance is currently connected and associated with the server handle. On the initial client connection, the Session Manager component in PAS for OpenEdge creates a session for the client. This session is assigned a unique identifier that is exchanged between the Session Manager and the client on all future HTTP requests. This article defines the behavior of the CONNECTED( ) method across the OpenEdge 12 releases for all clients: Windows (prowin, prowin32), character (_progres), PAS for OpenEdge (_mproapsv), .NET OpenClient, Java OpenClient and WebClient.


Default CONNECTED Behavior (11.5 – 12.2+)

CONNECTED( ) returns a logical value indicating whether the client made a successful connection to an ABL Session in a PAS for OpenEdge instance at any time in the past. It does not do any subsequent communication with the server to check if the connection is still valid. Unfortunately, this means CONNECTED( ) will always return TRUE after an initial connection even if the server is shut down. While this behavior was backward compatible it did not provide the required functionality to validate all of the connection points in the complex architecture of PAS for OpenEdge. Both the client and the server must be the same OpenEdge version.
 

Enhanced CONNECTED Behavior (12.2.5+, 12.3 – 12.4)

CONNECTED( ) returns a logical value indicating whether a Session Manager session is available to handle requests from the client. This implies that the client has made a successful CONNECT() call. To check if the connection is active, the client sends a HTTP HEAD request to the server with the session identifier the client received when it first connected to the PAS for OpenEdge instance. The following property values are required to get the enhanced connected behavior:

  • useHTTPSessions must be set to 1
  • useEnhancedConnected must be set to 1 (in 12.2.5+ only)
  • enableRequestChunking equal to 1 is recommended since it improves performance

Note: Both the client and the server must be the same OpenEdge version.

CONNECTED( ) will return TRUE if the session manager can reach a session with the session identifier. When the session receives the connected inquiry, the Session Manager session running time is reset to 0, like with any other client request. This affects the idleSessionTimeout and HTTPSessionTimeout values for this single session. When connected is called independently from a request to run ABL code, this can be used as a keep-alive feature.

CONNECTED( ) will return FALSE when the client 1) cannot reach the server or 2) the PAS for OpenEdge session manager cannot find a session with the identifier passed in from the client. When FALSE is returned, the client will mark the connection as “unavailable” and will never check the servers state again for this session. Note the server outage may NOT be persistent, in the case of intermittent HTTP errors (stateless protocol), but once the connection is marked as invalid by the client, it is marked as invalid and can no longer be used. Fault tolerance logic is expected to manage a client reconnect in this case.

Steps to enable usage of Enhanced CONNECTED behavior in 12.2.5+

  1. Configure the useEnhancedConnected property in openedge.properties under the APSV section
Values
  • If useEnhancedConnected=0, the CONNECTED() method returns TRUE once a valid http connection has been made
  • If useEnhancedConnected=1, the CONNECTED() method returns TRUE when there is valid session manager session available
Related Properties
  • useHTTPSessions must be set to 1
  • enableRequestChunking equal to 1 is recommended since it improves performance
Example (openedge.properties)
[<ablappname>.<webapp>.APSV]
        adapterEnabled=1
        enableRequestChunking=1
        oepingEnabled=0
        oepingProcedure=
        useEnhancedConnected=1
        useHTTPSessions=1
  1. Update oeablsecurity.csv file in all the webapps (This step is only necessary if connections use https to connect to pasoe):
  • For all login models except the "container" model add or uncomment:
"/apsv/**","OPTIONS","hasAnyRole('ROLE_PSCUser')" 
  • For the "container" login model add or uncomment:
"/apsv/**","OPTIONS","hasAnyRole('ROLE_PSCUser','ROLE_ANONYMOUS')"

Notes: 

  1. If a load balancer is used, configure the ‘main proxy configuration directive’ value to “apsv” ( example for Apache HTTP Server: ProxyPass"/apsv" )
  2. Instances created after 12.2.5 update will automatically have the lines in the oeablsecurity.csv file, but for existing instances running https, those lines need to be added.
How to determine if Enhanced CONNECTED is enabled (12.2.5+)
  1. HEAD messages in the localhost-access log
When Enhanced CONNECTED is enabled you will see HEAD messages in the <instance-dir>/logs/localhost-access.<date>.log file when the CONNECTED() method is used.

For example:
"HEAD /apsv/_connected HTTP/1.1" 200 - ROOT:a:0000004d
The HEAD /apsv/_connected message can only ever be seen if the feature is enabled.
  1. Use curl to call -X OPTIONS
For example:
curl http://localhost:8810/apsv -i -X OPTIONS
If it includes the server header CONNECTED/2.0, then useEnhancedConnected is enabled.
  1. Use OEJMX or oemanager REST API to "getProperties" from the agent to see how the property was set.
For the oemanager REST API, follow the instructions in the following article: How to get the properties of an agent using OE Manager's REST API?

For OEJMX:
Write the following query and save it as getProperties.qry:
{"O":"PASOE:type=OEManager,name=AgentManager","M":["getProperties","<agent-id or agent-pid>"]}
To execute the query:
<instance-dir>/bin/oejmx.sh -R -Q <input-query-path\file> -O <output-path\file>
This article discusses using OEJMX queries in more detail: Basic OEJMX Queries for inspecting and stopping PASOE agents
  1. Test it.  Connect to the AppServer from the ABL and test the CONNECTED() method.  
From the Procedure Editor, run the below code
DEFINE VARIABLE iCount AS INTEGER     NO-UNDO.

DEFINE VARIABLE hAs    AS HANDLE      NO-UNDO.

PAUSE 0 BEFORE-HIDE.

CREATE SERVER hAs.
hAs:CONNECT("-URL http://<host>:<port>/apsv").
DO WHILE TRUE:
    iCount = iCount + 1.
    MESSAGE hAs:CONNECTED() " count: " iCount.
    PAUSE 2 NO-MESSAGE.
END.
While the above code is running, stop PASOE. (e.g. <instance>/bin/tcman stop).  If no errors occur, the Enhanced CONNECTED is NOT enabled.
 
.
Workaround
Notes
Last Modified Date10/27/2021 3:32 PM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.