jdeppe-pivotal commented on pull request #5015: URL: https://github.com/apache/geode/pull/5015#issuecomment-621504482
I'm not sure whether this was meant to solve GEODE-7998, but here is a test that reproduces the original issue: ``` @Test public void testPubSubWithManyClientsDisconnecting() throws Exception { int CLIENT_COUNT = 10; int ITERATIONS = 400; Random random = new Random(); List<Jedis> clients = new ArrayList<>(); // Build up an initial set of subscribers for (int i = 0; i < CLIENT_COUNT; i++) { Jedis client = new Jedis("localhost", ports[0]); clients.add(client); CountDownLatch latch = new CountDownLatch(1); MockSubscriber mockSubscriber = new MockSubscriber(latch); executor.submit(() -> client.subscribe(mockSubscriber, CHANNEL_NAME)); latch.await(); } // Start actively publishing in the background Jedis publishingClient = new Jedis("localhost", ports[0]); Callable<Void> callable = () -> { for (int j = 0; j < ITERATIONS; j++) { publishingClient.publish(CHANNEL_NAME, "hello"); } return null; }; Future<Void> future = executor.submit(callable); // Abnormally close and recreate new subscribers without unsubscribing for (int i = 0; i < ITERATIONS; i++) { int candy = random.nextInt(CLIENT_COUNT); clients.get(candy).close(); Jedis client = new Jedis("localhost", ports[0]); CountDownLatch latch = new CountDownLatch(1); MockSubscriber mockSubscriber = new MockSubscriber(latch); executor.submit(() -> client.subscribe(mockSubscriber, CHANNEL_NAME)); // latch.await(1, TimeUnit.SECONDS); latch.await(); clients.set(candy, client); } // I'm not sure what to call so that this stat gets updated - just wait a few minutes // to see stuck threads reported in the log. // server1.invoke(() -> // assertThat(InternalResourceManager.getInternalResourceManager(ClusterStartupRule.getCache()).getStats() // .getNumThreadStuck()).isEqualTo(0) // ); future.get(); } ``` ---------------------------------------------------------------- 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