Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix unstoppable abnormal test
  • Loading branch information
donggyu04 committed Oct 30, 2020
commit 4adea12b70847e21d16aa5bd708af9f64e2c1106
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,14 @@ void runTestOn(final PerfTest perfTest, GrinderProperties grinderProperties, fin
singleConsole.addListener(new ConsoleShutdownListener() {
@Override
public void readyToStop(StopReason stopReason) {
perfTestService.markAbnormalTermination(perfTest, stopReason);
LOG.error("Abnormal test {} due to {}", perfTest.getId(), stopReason.name());
PerfTest fetchedPerftest = perfTestService.getOne(perfTest.getId());
if (fetchedPerftest.getStatus().isStoppable()) {
perfTestService.markAbnormalTermination(perfTest, stopReason);
LOG.error("Abnormal test {} due to {}", perfTest.getId(), stopReason.name());
}
}
});

long startTime = singleConsole.startTest(grinderProperties);
perfTest.setStartTime(ofEpochMilli(startTime));
addSamplingListeners(perfTest, singleConsole);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
import static org.ngrinder.common.util.Preconditions.checkNotEmpty;
import static org.ngrinder.common.util.Preconditions.checkNotNull;
import static org.ngrinder.common.util.TypeConvertUtils.cast;
import static org.ngrinder.model.Status.PREPARE_DISTRIBUTION;
import static org.ngrinder.model.Status.getProcessingOrTestingTestStatus;
import static org.ngrinder.model.Status.*;
import static org.ngrinder.perftest.repository.PerfTestSpecification.*;

/**
Expand Down Expand Up @@ -1033,7 +1032,6 @@ public void stop(User user, Long id) {
// This will be not be effective on cluster mode.
consoleManager.getConsoleUsingPort(perfTest.getPort()).cancel();
perfTest.setStopRequest(true);
perfTestRepository.save(perfTest);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion ngrinder-core/src/main/java/net/grinder/StopReason.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum StopReason {
TOO_MANY_ERRORS("Too many errors"),
/** Error while test preparation. */
ERROR_WHILE_PREPARE("Test preparation error"),
/** Error while first execution. */
/** Error while first execution or no recording. */
SCRIPT_ERROR("Script error"),
/** Error by too much overall traffic on the given region. */
TOO_MUCH_TRAFFIC_ON_REGION("Too much traffic error"),
Expand Down