This is an automated email from the ASF dual-hosted git repository.

bipinprasad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f96c24  [STORM-3758] Ignore upto 10 consecutive exceptions within 
Worker#checkCredentialsChanged (#3389)
3f96c24 is described below

commit 3f96c249cbc17ce062491bfbb39d484e241ab168
Author: Bipin Prasad <[email protected]>
AuthorDate: Tue Mar 23 11:30:31 2021 -0500

    [STORM-3758] Ignore upto 10 consecutive exceptions within 
Worker#checkCredentialsChanged (#3389)
    
    Co-authored-by: Bipin Prasad <[email protected]>
---
 .../src/jvm/org/apache/storm/daemon/worker/Worker.java | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java 
b/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
index f7b352c..6196893 100644
--- a/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
+++ b/storm-client/src/jvm/org/apache/storm/daemon/worker/Worker.java
@@ -277,9 +277,25 @@ public class Worker implements Shutdownable, DaemonCommon {
 
         establishLogSettingCallback();
 
+        final int credCheckMaxAllowed = 10;
+        final int[] credCheckErrCnt = new int[1]; // consecutive-error-count
+
         workerState.refreshCredentialsTimer.scheduleRecurring(0,
                                                               (Integer) 
conf.get(Config.TASK_CREDENTIALS_POLL_SECS), () -> {
-                checkCredentialsChanged();
+                try {
+                    checkCredentialsChanged();
+                    credCheckErrCnt[0] = 0;
+                } catch (Exception ex) {
+                    credCheckErrCnt[0]++;
+                    if (credCheckErrCnt[0] <= credCheckMaxAllowed) {
+                        LOG.warn("Ignoring {} of {} consecutive exceptions 
when checking for credential change",
+                            credCheckErrCnt[0], credCheckMaxAllowed, ex);
+                    } else {
+                        LOG.error("Received {} consecutive exceptions, {} 
tolerated, when checking for credential change",
+                            credCheckErrCnt[0], credCheckMaxAllowed, ex);
+                        throw ex;
+                    }
+                }
             });
 
         workerState.checkForUpdatedBlobsTimer.scheduleRecurring(0,

Reply via email to