Connect-SOAP timeout is not working
User is on Pega 7.1.7 and reported that the SOAP connector is not timing out per the value configured in response timeout field in Connect-SOAP rule form when connecting to an invalid endpoint URL.
Although response timeout is set on a Connect-SOAP rule, but the connection times out after longer duration than the set timeout value.
Steps to Reproduce
- Create a SOAP connector.
- Configure it to connect to an invalid endpoint to which connection is established but it does not respond back.
- Configure 120 seconds as timeout in the response timeout field of Connect-SOAP rule form.
- Run the tracer and Invoke the SOAP connector from an activity.
- In the tracer logs one can see the InvokeAxis2 activity failing after 85 seconds where-as user had configured the response timeout value as 120 seconds.
The reported behavior is not related to any problem within Pega product. The system is behaving per design.
Here’s the explanation for the reported behavior:
Timeout value configured on connector rule form is both socket timeout and connection timeout. If this timeout duration configured on rule form is less than the actual time taken by service to respond, then socketTimeout exception is thrown at client side itself (in socket implementation) and all the connection resources are released properly and connection retry does not happen after that. But If the connection timeout value configured on rule form is more than service response time then it can end up in two ways:
- Valid URL - Connection is established and service is sending some response – In this case the connection will timeout per configured value on rule form if the service does not respond within configured time.
- Invalid URL - Connection failed and connect exception is returned - In this scenario some exception is thrown and HttpClient retries to establish connection 3 more times with the same timeout value.
Let's assume that a service takes 21 seconds to return connection exception.
- If timeout set on rule form is 20 seconds – In this case SocketTImeoutException is thrown at client side itself after 20 seconds and we can see error response screen. This is because the configured timeout value on rule form is within ~21 seconds (which is the time taken by service to return error response)
- If timeout set on rule form is 60 seconds (which is more than the 21 seconds of time needed by service to return error response) – In this case the service URL sends some error response after 21 seconds. After this system retries to establish connection for 3 more times. On each attempt it takes 21 seconds (which is time needed by service to send error response). The final timeout in this case occurs after 4*21 seconds (~ 85 seconds).