You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/09/15 12:44:44 UTC

[GitHub] [geode] ringles commented on a change in pull request #6866: GEODE-9495: Limit Thread Sleep In PubSubNativeRedisAcceptanceTest

ringles commented on a change in pull request #6866:
URL: https://github.com/apache/geode/pull/6866#discussion_r709147797



##########
File path: geode-apis-compatible-with-redis/src/acceptanceTest/java/org/apache/geode/redis/internal/executor/pubsub/PubSubNativeRedisAcceptanceTest.java
##########
@@ -25,20 +31,50 @@
 public class PubSubNativeRedisAcceptanceTest extends AbstractPubSubIntegrationTest {
 
   private static final Logger logger = LogService.getLogger();
+  private static long socketTimeWaitMsec = 240000;
 
   @ClassRule
   public static NativeRedisTestRule redis = new NativeRedisTestRule();
 
+  @BeforeClass
+  public static void runOnce() throws IOException {
+    Process process;
+    if (SystemUtils.IS_OS_LINUX) {
+      try {
+        process = Runtime.getRuntime().exec("cat /proc/sys/net/ipv4/tcp_fin_timeout");
+        BufferedReader reader = new BufferedReader(
+            new InputStreamReader(process.getInputStream()));
+        String line = reader.readLine();
+        socketTimeWaitMsec = Long.parseLong(line.trim());
+      } catch (NumberFormatException | IOException ignored) {
+      }
+    } else if (SystemUtils.IS_OS_MAC) {
+      try {
+        process = Runtime.getRuntime().exec("sysctl net.inet.tcp.msl");
+        BufferedReader reader = new BufferedReader(
+            new InputStreamReader(process.getInputStream()));
+        String line = reader.readLine();
+        String[] parts = line.split(":");
+        if (parts.length == 2) {
+          socketTimeWaitMsec = 2 * Long.parseLong(parts[1].trim());
+          System.out.println("TIME_WAIT: " + socketTimeWaitMsec);

Review comment:
       Whoops, thought I'd done that!




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

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