Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-10684

Memory leak in persistent IgniteSet

    XMLWordPrintableJSON

    Details

    • Flags:
      Important

      Description

      Hello. I have found a leak in IgniteSet with using persistence. Here is my Unit Test:

      import org.apache.ignite.Ignite;
      import org.apache.ignite.IgniteSet;
      import org.apache.ignite.Ignition;
      import org.apache.ignite.cache.CacheMode;
      import org.apache.ignite.configuration.*;
      import org.junit.Test;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      import java.util.UUID;
      import java.util.concurrent.LinkedBlockingQueue;
      import java.util.concurrent.ThreadPoolExecutor;
      import java.util.concurrent.TimeUnit;
      
      /**
       * @author Alexey Belov
       */
      public class IgniteManagerTest {
      
          protected final Logger log = LoggerFactory.getLogger(IgniteManagerTest.class);
          private ThreadPoolExecutor ex = new ThreadPoolExecutor(8, 8,
                  0L, TimeUnit.MILLISECONDS,
                  new LinkedBlockingQueue<Runnable>());
      
          @Test
          public void start() throws Exception {
              final IgniteConfiguration cfg = new IgniteConfiguration();
              final DataStorageConfiguration dataStorageConfiguration = new DataStorageConfiguration();
              final String igniteStorageDir = "g:\\work\\garbage\\igniteTest\\" + UUID.randomUUID().toString();
              System.out.println(igniteStorageDir);
              dataStorageConfiguration.setStoragePath(igniteStorageDir);
              final DataRegionConfiguration defaultDataRegionConfiguration = dataStorageConfiguration
                      .getDefaultDataRegionConfiguration();
              defaultDataRegionConfiguration.setEvictionThreshold(0.9);
              defaultDataRegionConfiguration.setMetricsEnabled(true);
              defaultDataRegionConfiguration.setPersistenceEnabled(true);
              dataStorageConfiguration.setWalMode(WALMode.NONE);
              cfg.setDataStorageConfiguration(dataStorageConfiguration);
              final Ignite ignite = Ignition.start(cfg);
              ignite.cluster().active(true);
      
      
              while (true) {
                  if (ex.getQueue().size() < 8) {
                      System.out.println("added task " + ex.getQueue().size() + " " + ex.getActiveCount());
                      ex.execute(() -> runQueues(ignite));
                  }
                  Thread.sleep(1000);
              }
          }
      
          private void qu() {
      
          }
      
          private void runQueues(Ignite ignite) {
              for (int j = 0; j < 10; j++) {
                  final CollectionConfiguration setConfig = new CollectionConfiguration();
                  setConfig.setCacheMode(CacheMode.LOCAL);
                  setConfig.setBackups(0);
                  final String name = "set-" + j + UUID.randomUUID().toString();
                  setConfig.setGroupName(name);
                  final IgniteSet<Object> set = ignite
                          .set(name, setConfig);
                  final int i1 = 1000;
                  for (int i = 0; i < i1; i++) {
                      final String elem1 = UUID.randomUUID().toString();
                      set.add(elem1);
                  }
                  log.info(j + "write");
      
                  set.clear();
                  set.close();
                  ignite.destroyCache(name);
              }
              log.info("Finish!");
          }
      }
      
      

      See the attached screenshots from JProfiler.

      I think, that it should not be like this, because i clear the set and memory should be freed.

      If i launch this test with queue it works fine, memory becomes free after some time.

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              zafiglon Alexey Belov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: