You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/06/05 15:36:00 UTC

[jira] [Commented] (GEODE-7591) potential hang

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

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

bschuchardt commented on a change in pull request #5182:
URL: https://github.com/apache/geode/pull/5182#discussion_r436001138



##########
File path: geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java
##########
@@ -370,6 +371,33 @@ public void testWaitForViewInstallation() {
         .untilAsserted(() -> assertThat(waitForViewInstallationDone.get()).isTrue());
   }
 
+  /**
+   * show that waitForViewInstallation works as expected when distribution manager is closed
+   * while waiting for the latest membership view to install
+   */
+  @Test
+  public void testWaitForViewInstallationDisconnectDS() {
+    InternalDistributedSystem system = getSystem();
+    ClusterDistributionManager dm = (ClusterDistributionManager) system.getDM();
+    MembershipView<InternalDistributedMember> view = dm.getDistribution().getView();
+
+    AtomicBoolean waitForViewInstallationDone = new AtomicBoolean();
+    executorService.submit(() -> {
+      try {
+        dm.waitForViewInstallation(view.getViewId() + 1);
+        waitForViewInstallationDone.set(true);
+      } catch (InterruptedException e) {
+        errorCollector.addError(e);
+      }
+    });
+
+    await().timeout(2000, TimeUnit.MILLISECONDS);

Review comment:
       pauses like this often cause tests to periodically fail in CI.  Waiting for a semaphore to be triggered by the executor thread might be better.




----------------------------------------------------------------
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:
users@infra.apache.org


> potential hang
> --------------
>
>                 Key: GEODE-7591
>                 URL: https://issues.apache.org/jira/browse/GEODE-7591
>             Project: Geode
>          Issue Type: Improvement
>          Components: membership
>            Reporter: Bruce J Schuchardt
>            Assignee: Jakov Varenina
>            Priority: Major
>
> This method in ClusterDistributionManager waits for a new membership view to be installed, but if the cache is being closed while waiting the method could hang because it only checks for cache closure if the object it's waiting on is notified.  We should change the wait() to have a timeout so that the `stopper` is polled periodically
> {code:java}
> void waitForViewInstallation(long id) throws InterruptedException {
>   if (id <= membershipViewIdAcknowledged) {
>     return;
>   }
>   synchronized (membershipViewIdGuard) {
>     while (membershipViewIdAcknowledged < id && !stopper.isCancelInProgress()) {
>       if (logger.isDebugEnabled()) {
>         logger.debug("waiting for view {}.  Current DM view processed by all listeners is {}", id,
>             membershipViewIdAcknowledged);
>       }
>       membershipViewIdGuard.wait();
>     }
>   }
> }
>  {code}



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