Expiration issue when TTL and Idle Timeout are both defined
search cancel

Expiration issue when TTL and Idle Timeout are both defined

book

Article ID: 294419

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

Generally speaking, you can set both Time-To-Live (TTL) and Idle timeout for region entries, as long as they do not contradict each other. However, there are some caveats to be aware of.

Environment

Product Version: 9.10

Resolution

One specific case where you define both will cause the entry to never expire.
For example, if you define the expiration like this:

Create region --name="MyRegion"  --entry-idle-time-expiration-action="destroy" --entry-time-to-live-expiration="300"   --entry-time-to-live-expiration-action="destroy"

You have defined the action for "entry idle time" expiration, but you have forgotten to define the timeout value for it.
In this case, GemFire will automatically set the timeout to "0" for the missing idle expiration timeout.
This is how the expiration configuration for this region would look in XML:  

<entry-time-to-live>
<expiration-attributes action="destroy" timeout="300"/> 
</entry-time-to-live>
<entry-idle-time>
 <expiration-attributes action="destroy" timeout="0"/>
</entry-idle-time>

As "0" means "never expire", GemFire now has to choose one from these contradicting settings, between "300 seconds" TTL timeout and "never expire" for the idle timeout.
In this case, you will see that the entries never expire as GemFire will choose the safer choice.
In general, however, GemFire will choose whichever happens first.