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

ASF GitHub Bot commented on GEODE-8119:
---------------------------------------

mkevo commented on a change in pull request #5167:
URL: https://github.com/apache/geode/pull/5167#discussion_r431672982



##########
File path: 
geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/Geode8119RegressionDistributedTest.java
##########
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.internal.cache;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static 
org.apache.geode.distributed.ConfigurationProperties.START_LOCATOR;
+import static 
org.apache.geode.internal.AvailablePortHelper.getRandomAvailableTCPPortsForDUnitSite;
+import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
+import static org.apache.geode.test.dunit.VM.getVM;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Properties;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import org.apache.geode.cache.DiskStoreFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.serialization.Version;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.rules.CacheRule;
+import org.apache.geode.test.dunit.rules.DistributedRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+import 
org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
+
+@RunWith(Parameterized.class)
+public class Geode8119RegressionDistributedTest implements Serializable {
+  private static final String REGION_NAME = "TestRegion";
+  private static final String DISK_STORE_ID = "testDisk";
+
+  @Rule
+  public CacheRule cacheRule = new CacheRule();
+
+  @Rule
+  public transient GfshCommandRule gfsh = new GfshCommandRule();
+
+  @Rule
+  public DistributedRule distributedRule = new DistributedRule();
+
+  @Rule
+  public SerializableTemporaryFolder temporaryFolder = new 
SerializableTemporaryFolder();
+
+  @Parameterized.Parameter
+  public RegionShortcut regionShortcut;
+
+  @Parameterized.Parameters(name = "RegionType={0}")
+  public static Iterable<RegionShortcut> data() {
+    return Arrays.asList(RegionShortcut.PARTITION_PERSISTENT, 
RegionShortcut.REPLICATE_PERSISTENT);
+  }
+
+  private Properties createLocatorConfiguration(int localLocatorPort) {
+    Properties config = new Properties();
+    config.setProperty(MCAST_PORT, "0");
+    config.setProperty(LOCATORS, "localhost[" + localLocatorPort + ']');
+    config.setProperty(START_LOCATOR,
+        "localhost[" + localLocatorPort + 
"],server=true,peer=true,hostname-for-clients=localhost");
+
+    return config;
+  }
+
+  private Properties createServerConfiguration(int localLocatorPort) {
+    Properties config = new Properties();
+    config.setProperty(MCAST_PORT, "0");
+    config.setProperty(LOCATORS, "localhost[" + localLocatorPort + ']');
+
+    return config;
+  }
+
+  private void createDiskStore(File[] diskStoreDirectories) {
+    DiskStoreFactory diskStoreFactory = 
cacheRule.getCache().createDiskStoreFactory();
+    diskStoreFactory.setMaxOplogSize(1);
+    diskStoreFactory.setAutoCompact(true);
+    diskStoreFactory.setAllowForceCompaction(true);
+    diskStoreFactory.setDiskDirs(diskStoreDirectories);
+
+    diskStoreFactory.create(DISK_STORE_ID);
+  }
+
+  private void createRegion() {
+    cacheRule.getCache()
+        .<String, String>createRegionFactory(regionShortcut)
+        .setDiskStoreName(DISK_STORE_ID)
+        .create(REGION_NAME);
+  }
+
+  private void createServerWithRegionAndPersistentRegion(File[] 
diskStoreDirectories) {
+    createDiskStore(diskStoreDirectories);
+    createRegion();
+    cacheRule.getCache().getRegion(REGION_NAME);
+  }
+
+  private void gracefullyDisconnect() {
+    
InternalDistributedSystem.getConnectedInstance().stopReconnectingNoDisconnect();
+    InternalDistributedSystem.getConnectedInstance().disconnect();
+    await()
+        .untilAsserted(() -> 
assertThat(InternalDistributedSystem.getConnectedInstance()).isNull());
+  }
+
+  @Test
+  public void regressionTest() throws IOException {
+    VM locator, server;
+    final int ENTRIES = 100000;
+    final Host host = Host.getHost(0);
+    int site1Port = getRandomAvailableTCPPortsForDUnitSite(1)[0];
+    File diskStoreDirectory1 = temporaryFolder.newFolder("diskDir1");
+    File diskStoreDirectory2 = temporaryFolder.newFolder("diskDir2");

Review comment:
       Use only one dir works. So when you change this part to:
   ```
       File[] diskStoreDirectories = new File[] 
{temporaryFolder.newFolder("diskDir1")};
   
       String diskDirs = 
Arrays.stream(diskStoreDirectories).map(File::getAbsolutePath)
           .collect(Collectors.joining(","));
   ```
   test is executed successfully.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Threads are not properly closed when offline disk-store commands are invoked
> ----------------------------------------------------------------------------
>
>                 Key: GEODE-8119
>                 URL: https://issues.apache.org/jira/browse/GEODE-8119
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh
>            Reporter: Mario Kevo
>            Assignee: Mario Kevo
>            Priority: Major
>
> Threads can be opened when you are online and offline, but close only when 
> you are online. Once some offline command started thread it cannot be closed 
> and after some time if there is a bigger number of this threads it can lead 
> to OOM exception.
> Also the problem is that its validating only disk-dirs but not diskStore 
> name. So thread can be created but there is no diskStore with that name and 
> it will also hang.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to