helix
helix copied to clipboard
Metaclient abstractPuppy not interrupting running thread all the time
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();
}
}