@Test
  public void putShouldNotHangAfterBucketCrashesBeforePrimarySelection() {
    server1.invoke(
        () -> handleBeforeProcessMessage(ManageBucketReplyMessage.class, this::crashServer));
    server1.invoke(this::createPartitionedRegion);

    // Create a couple of buckets in VM0. This will make sure
    // the next bucket we create will be created in VM 1.
    server1.invoke(() -> putData(0, 2, "a"));

    server2.invoke(this::createPartitionedRegion);

    // Trigger a bucket creation in VM1, which should cause server1 to close it's cache.
    assertThatThrownBy(() -> server1.invoke(() -> putData(3, 4, "a")))
        .isInstanceOf(RMIException.class)
        .hasCauseInstanceOf(DistributedSystemDisconnectedException.class);

    assertThat(server2.invoke(this::getBucketList)).containsExactly(3);

    // This shouldn't hang, because the bucket creation should finish,.
    server2.invoke(() -> putData(3, 4, "a"));
  }
Test the we can handle a member departing after creating a bucket on the remote node but before
we choose a primary
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/BucketCreationCrashRegressionTest.java