Pivotal Knowledge Base


How to limit the number of retry attempts for function executions


Product Version
Pivotal GemFire Tested with 8.2.1


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.


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 Connection[]@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.


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="" port="55221"/>

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.


Powered by Zendesk