Pivotal Knowledge Base

Follow

How to limit the number of retry attempts for function executions

Environment

Product Version
Pivotal GemFire Tested with 8.2.1

Purpose

This article describes how to limit the number of retry attempts for function executions that exceed their client function timeout when both requirements are fulfilled: the system property gemfire.CLIENT_FUNCTION_TIMEOUT is set and isHA() returns true.

Cause

When the Java system property gemfire.CLIENT_FUNCTION_TIMEOUT is set on the client side, you may see the following warning message after a client function timeout:

[warn 2016/07/06 11:26:23.301 JST <main> tid=0x1] Pool unexpected socket timed out on client connection=Pooled Connection to 172.16.227.2:61592: Connection[172.16.227.2:61592]@2068897588). Server unreachable: could not connect after 1 attempts

If the isHA() method of the function object returns false, the client will cease waiting on results immediately after the function timeout. However, if the isHA() method returns true, the client may retry the function call an indefinite number of times.

In that case, you want the client to give up after some predetermined number of retry attempts.

Procedure

The client can be configured to give up after a fixed number of retry attempts by setting the retry-attempts attribute of the pool element of the client's cache.xml; an example is shown below:

<client-cache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  ...
   <pool name="client" subscription-enabled="true" retry-attempts="2">
      <locator host="172.16.227.2" port="55221"/>
   </pool>
  ...
</client-cache>

In the above example, the client will retry twice, meaning that the client will give up after three attempts.

Additional Information

For further information, please refer to the following resource: 

Calling Function Execute with timeout

Internal Comments

JIRA ticket GEM-753 has also been filed for not retrying attempts infinitely. By default, retry-attempts is "-1". So, the client should give up retry attempts after it tries to connect all the existing servers and fails them by client function timeout.

Comments

Powered by Zendesk