[ https://issues.apache.org/jira/browse/IGNITE-3513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15388166#comment-15388166 ]
Andrey Gura commented on IGNITE-3513: ------------------------------------- I see two possible solutions: * {{CleanupWorker}} can sleep for little periods of time and periodically call {{expire()}} method. * {{GridCacheTtlManager.addTrackedEntry()}} method can check some volatile field with nearest expiration time and notify {{CleanupWorker}} in case when added entry has expiration time less than nearest expiration time. It requires usage of synchronization for {{wait/notify}} and can lead to contention in case when added entries have decreasing sequence of expiration time values. See commit https://github.com/apache/ignite/pull/880/commits/f3261b50f17848339b141a900f8c97a61bdbc7ca > Cleanup worker is placed in the Thread's waiting queue using Thread.sleep > method > -------------------------------------------------------------------------------- > > Key: IGNITE-3513 > URL: https://issues.apache.org/jira/browse/IGNITE-3513 > Project: Ignite > Issue Type: Bug > Affects Versions: 1.6 > Reporter: Denis Magda > Assignee: Andrey Gura > Fix For: 1.7 > > > There is a bug in current implementation of > {{GridCacheTtlManager#CleanupWorker}}. > Refer to the implementation's code snippet and the details below. > {code} > EntryWrapper first = pendingEntries.firstx(); > if (first != null) { > long waitTime = first.expireTime - U.currentTimeMillis(); > if (waitTime > 0) > U.sleep(waitTime); > } > {code} > 1. Put first item with TTL = 1 hour. CleanupWorker will go to sleep for 1 > hour. > 2. Put second item with TTL = 1 minute. Since > CleanupWorker's thread sleeps now, second item will not be expired at the > time. > NOTE: This scenario is easily to reproducible if first and second items are > put into cache asynchronously. If try to put them in same thread one-by-one > expiration may work fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)