You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/05/17 17:35:04 UTC

[jira] [Commented] (IGNITE-5227) StackOverflowError in GridCacheMapEntry#checkOwnerChanged()

    [ https://issues.apache.org/jira/browse/IGNITE-5227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16014465#comment-16014465 ] 

ASF GitHub Bot commented on IGNITE-5227:
----------------------------------------

GitHub user mcherkasov opened a pull request:

    https://github.com/apache/ignite/pull/1967

    IGNITE-5227: StackOverflowError in GridCacheMapEntry#checkOwnerChanged()

    StackOverflowError occurs due recursion in methods:
    GridCacheMapEntry.checkOwnerChanged -> GridDistributedCacheEntry.checkThreadChain -> GridDistributedCacheEntry.recheck -> GridCacheMapEntry.checkOwnerChanged
    
    I broke this cycle by introducing "checkCandidateChain" flag in GridCacheMapEntry.checkOwnerChanged method, which allow to miss GridDistributedCacheEntry.checkThreadChain. 
    The check fo the whole candidate chain is moved to GridDistributedCacheEntry.checkThreadChain method, as you can see there  already was cycle for this, I've just removed break(put it in else branch in case we don't have any kes for lock candidates).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mcherkasov/ignite master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/1967.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1967
    
----
commit fbe059e8003b04568a39a3cfb604a248928d1f6f
Author: mcherkasov <mc...@gridgain.com>
Date:   2017-05-17T17:12:14Z

    IGNITE-5227: StackOverflowError in GridCacheMapEntry#checkOwnerChanged()

----


> StackOverflowError in GridCacheMapEntry#checkOwnerChanged()
> -----------------------------------------------------------
>
>                 Key: IGNITE-5227
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5227
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Alexey Goncharuk
>            Assignee: Mikhail Cherkasov
>            Priority: Critical
>             Fix For: 2.1
>
>
> A simple test reproducing this error:
> {code}
>     /**
>      * @throws Exception if failed.
>      */
>     public void testBatchUnlock() throws Exception {
>        startGrid(0);
>        grid(0).createCache(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME)
>             .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
>         try {
>             final CountDownLatch releaseLatch = new CountDownLatch(1);
>             IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
>                 @Override public Object call() throws Exception {
>                     IgniteCache<Object, Object> cache = grid(0).cache(null);
>                     Lock lock = cache.lock("key");
>                     try {
>                         lock.lock();
>                         releaseLatch.await();
>                     }
>                     finally {
>                         lock.unlock();
>                     }
>                     return null;
>                 }
>             });
>             Map<String, String> putMap = new LinkedHashMap<>();
>             putMap.put("key", "trigger");
>             for (int i = 0; i < 10_000; i++)
>                 putMap.put("key-" + i, "value");
>             IgniteCache<Object, Object> asyncCache = grid(0).cache(null).withAsync();
>             asyncCache.putAll(putMap);
>             IgniteFuture<Object> resFut = asyncCache.future();
>             Thread.sleep(1000);
>             releaseLatch.countDown();
>             fut.get();
>             resFut.get();
>         }
>         finally {
>             stopAllGrids();
>         }
> {code}
> We should replace a recursive call with a simple iteration over the linked list.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)