[ 
https://issues.apache.org/jira/browse/IGNITE-9128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Pereslegin updated IGNITE-9128:
-------------------------------------
    Description: 
Continuous query handlers don't clean up after the cache was stopped.

Reproducer shows resource leak:
{code:java}
public class Reproducer extends GridCommonAbstractTest {
    /** */
    private static final String CACHE1 = "cache1";

    /** */
    public void testCacheRecreate() throws Exception {
        IgniteEx node = startGrid(0);

        int hndCntr = 0;

        try {
            for (int i = 0; i < 100; i++) {
                IgniteCache<Integer, Integer> cache = node.createCache(CACHE1);

                cache.query(new ContinuousQuery<>().setLocalListener(evts -> 
{}));

                cache.destroy();
            }

            for (Object locInfo : ((Map)U.field(node.context().continuous(), 
"locInfos")).values()) {
                GridContinuousHandler hnd = U.field(locInfo, "hnd");

                if (CACHE1.equals(hnd.cacheName()))
                    ++hndCntr;
            }

            assertEquals("No local handlers expected after cache was stopped.", 
0, hndCntr);
        }
        finally {
            stopAllGrids();
        }
    }
}
{code}

Output:
{noformat}
junit.framework.AssertionFailedError: No local handlers expected after cache 
was stopped. 
Expected :0
Actual   :100
{noformat}


  was:
Continuous query handlers don't clean up after the cache was stopped.

Reproducer shows resource leak:
{code:java}
public class Reproducer extends GridCommonAbstractTest {
    /** */
    private static final String CACHE1 = "cache1";

    /** */
    public void testCacheRecreate() throws Exception {
        IgniteEx node = startGrid(0);

        int hndCntr = 0;

        try {
            for (int i = 0; i < 100; i++) {
                IgniteCache<Integer, Integer> cache = node.createCache(CACHE1);

                cache.query(new ContinuousQuery<>().setLocalListener(evts -> 
{}));

                cache.put(1, 1);

                cache.destroy();
            }

            for (Object locInfo : ((Map)U.field(node.context().continuous(), 
"locInfos")).values()) {
                GridContinuousHandler hnd = U.field(locInfo, "hnd");

                if (CACHE1.equals(hnd.cacheName()))
                    ++hndCntr;
            }

            assertEquals("No local handlers expected after cache was stopped.", 
0, hndCntr);
        }
        finally {
            stopAllGrids();
        }
    }
}
{code}

Output:
{noformat}
junit.framework.AssertionFailedError: No local handlers expected after cache 
was stopped. 
Expected :0
Actual   :100
{noformat}



> Continuous query handlers don't clean up after cache was stopped.
> -----------------------------------------------------------------
>
>                 Key: IGNITE-9128
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9128
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 2.6
>            Reporter: Pavel Pereslegin
>            Priority: Major
>
> Continuous query handlers don't clean up after the cache was stopped.
> Reproducer shows resource leak:
> {code:java}
> public class Reproducer extends GridCommonAbstractTest {
>     /** */
>     private static final String CACHE1 = "cache1";
>     /** */
>     public void testCacheRecreate() throws Exception {
>         IgniteEx node = startGrid(0);
>         int hndCntr = 0;
>         try {
>             for (int i = 0; i < 100; i++) {
>                 IgniteCache<Integer, Integer> cache = 
> node.createCache(CACHE1);
>                 cache.query(new ContinuousQuery<>().setLocalListener(evts -> 
> {}));
>                 cache.destroy();
>             }
>             for (Object locInfo : ((Map)U.field(node.context().continuous(), 
> "locInfos")).values()) {
>                 GridContinuousHandler hnd = U.field(locInfo, "hnd");
>                 if (CACHE1.equals(hnd.cacheName()))
>                     ++hndCntr;
>             }
>             assertEquals("No local handlers expected after cache was 
> stopped.", 0, hndCntr);
>         }
>         finally {
>             stopAllGrids();
>         }
>     }
> }
> {code}
> Output:
> {noformat}
> junit.framework.AssertionFailedError: No local handlers expected after cache 
> was stopped. 
> Expected :0
> Actual   :100
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to