helix icon indicating copy to clipboard operation
helix copied to clipboard

Metaclient abstractPuppy not interrupting running thread all the time

Open xyuanlu opened this issue 1 year ago • 0 comments

Describe the bug

While running chaos tests for metaclient, we notice sometimes puppy implementation hang after test finish. This is because we only catch interrupt exception while sleep() but not when bark().

public void run() {
    try {
      while (true) {
        try {
          bark();
        } catch (Exception e) {
          incrementUnhandledErrorCounter();
          e.printStackTrace();
        }
        if (getPuppySpec().getMode() == PuppyMode.ONE_OFF) {
          cleanup();
          break;
        } else {
          try {
            Thread.sleep(getPuppySpec().getExecDelay().getNextDelay());
          } catch (InterruptedException e) {
            cleanup();
            break;
            // Handle interruption if necessary
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

xyuanlu avatar Jul 27 '23 00:07 xyuanlu