@Test
  public void threadsAreCleanedUpWhenStartFails() throws Exception {
    Properties configProperties = new Properties();
    configProperties.setProperty(LOG_FILE, "");
    configProperties.setProperty(MCAST_PORT, "0");

    int threadCount = Thread.activeCount();

    Throwable thrown = catchThrowable(
        () -> locator = Locator.startLocatorAndDS(-2, null, configProperties));

    assertThat(thrown).isInstanceOf(IllegalArgumentException.class);

    for (int i = 0; i < 10; i++) {
      if (threadCount < Thread.activeCount()) {
        Thread.sleep(1000);
      }
    }

    OSProcess.printStacks(0);

    assertThat(threadCount)
        .as("Expected " + threadCount + " threads or fewer but found " + Thread.activeCount()
            + ". Check log file for a thread dump.")
        .withThreadDumpOnError()
        .isGreaterThanOrEqualTo(Thread.activeCount());
  }
Fix: if jmx-manager-start is true in a locator then gfsh connect will fail
geode-core/src/integrationTest/java/org/apache/geode/distributed/LocatorIntegrationTest.java