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 2022/05/25 20:04:36 UTC

[GitHub] [geode] DonalEvans opened a new pull request, #7721: GEODE-10329: Handle RejectedExecutionException

DonalEvans opened a new pull request, #7721:
URL: https://github.com/apache/geode/pull/7721

   Do not throw RejectedExecutionException if the GMSHealthMonitor is
   stopping
   
   Authored-by: Donal Evans <do...@vmware.com>
   
   <!-- Thank you for submitting a contribution to Apache Geode. -->
   
   <!-- In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken: 
   -->
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   - [ ] Does `gradlew build` run cleanly?
   
   - [ ] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   <!-- Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   -->
   


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


[GitHub] [geode] pivotal-jbarrett commented on a diff in pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on code in PR #7721:
URL: https://github.com/apache/geode/pull/7721#discussion_r894035523


##########
geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java:
##########
@@ -1425,6 +1425,16 @@ private void sendSuspectRequest(final List<SuspectRequest<ID>> requests) {
     processMessage(smm);
   }
 
+  void doAndIgnoreRejectedExecutionExceptionIfStopping(final Checker checker) {

Review Comment:
   Looks like `Runnable` would suffice rather than building our own interface.



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


[GitHub] [geode] DonalEvans commented on pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
DonalEvans commented on PR #7721:
URL: https://github.com/apache/geode/pull/7721#issuecomment-1146480015

   > I think this should have tests associated with it. If we are explicitly catching and exception and optionally ignoring it there should be tests that cover both cases.
   
   I'm going to need some help with writing a test that consistently hits the race condition where the `checkExecutor` is shut down and then attempts to execute something. I wasn't able to reproduce the failure in 2000 runs of the distributed test that originally hit it, and making a unit test for it seems extremely difficult as there is very little visibility into the methods that would need to be stubbed/modified in order to ensure things happen in the order we want.


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


[GitHub] [geode] DonalEvans commented on pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
DonalEvans commented on PR #7721:
URL: https://github.com/apache/geode/pull/7721#issuecomment-1138681241

   The failing DUnit test is due to https://issues.apache.org/jira/browse/GEODE-8411, which is a known flaky test and unrelated to the changes in this PR.


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


[GitHub] [geode] pivotal-jbarrett commented on pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on PR #7721:
URL: https://github.com/apache/geode/pull/7721#issuecomment-1151458738

   @DonalEvans what if we refactored a little to a method that takes function to execute and optionally ignores this specific exception, then we could at least deterministically test that part of the behavior and change in this PR. 🤷 
   ```java
   private void doAndIgnoreRejectedExecutionExceptionIfStopping(final SomeFunctionalnterface someFunctionalThing) {
     try {
       someFunctionalThing.doIt();
     } catch (RejectedExecutionException e) {
       if (!isStopping) {
         throw e;
       }
     }
   }
   
   ...
         doAndIgnoreRejectedExecutionExceptionIfStopping(() ->
           checkExecutor.execute(() -> {
              try {
                inlineCheckIfAvailable(initiator, cv, true, mbr, reason);
              } catch (MembershipClosedException e) {
                // shutting down
              } catch (Exception e) {
                logger.info("Unexpected exception while verifying member", e);
              }
            }));
   ...
   ```
   
   
   
   ```java
   @Test
   void doAndIgnoreRejectedExecutionExceptionIfStoppingThrowsWhenNotStopping() {
     gmsHealthMonitor.isStopping = true;
     assertThatThrowBy(() -> gmsHealthMonitor.doAndIgnoreRejectedExecutionExceptionIfStopping(() -> {throw new RejectedExecutionException();})).isInstanceOf(RejectedExecutionException.class);
   }
   ```
   
   


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


[GitHub] [geode] pivotal-jbarrett commented on a diff in pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
pivotal-jbarrett commented on code in PR #7721:
URL: https://github.com/apache/geode/pull/7721#discussion_r894035661


##########
geode-membership/src/test/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorTest.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal.membership.gms.fd;
+
+import static org.assertj.core.api.Assertions.assertThatNoException;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.concurrent.RejectedExecutionException;
+
+import org.junit.Test;

Review Comment:
   Use JUnit 5.



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


[GitHub] [geode] DonalEvans merged pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
DonalEvans merged PR #7721:
URL: https://github.com/apache/geode/pull/7721


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


[GitHub] [geode] DonalEvans commented on pull request #7721: GEODE-10329: Handle RejectedExecutionException

Posted by GitBox <gi...@apache.org>.
DonalEvans commented on PR #7721:
URL: https://github.com/apache/geode/pull/7721#issuecomment-1151676410

   @pivotal-jbarrett Thanks for the advice! I think I managed to implement what you suggested; please let me know if it needs further tweaks.


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