Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mitigation for process hangs #1048

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void run() {
new TimeOutDecoratedTestSource(paramsFromParent.timeoutStrategy,
tests, this.reporter));

this.reporter.done(ExitCode.OK);
repeatedlySendDoneSignal();
} catch (final Throwable ex) {
ex.printStackTrace(System.out);
LOG.log(Level.WARNING, "Error during mutation test", ex);
Expand All @@ -109,6 +109,17 @@ public void run() {

}

private void repeatedlySendDoneSignal() throws InterruptedException {
// there have been reports of the done signal getting lost, causing the main process
// to hang. The root cause of this issue has not been found, this attempts to mitigate it
// by resending the signal. We don't want to spend too long doing this, as it is better for
// the minion to end naturally, than be killed by the main process.
for (int i = 0; i != 10; i++) {
this.reporter.done(ExitCode.OK);
Thread.sleep(100);
}
}

private void configureVerbosity(MinionArguments paramsFromParent) {
Log.setVerbose(paramsFromParent.verbosity());
if (!paramsFromParent.verbosity().showMinionOutput()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.pitest.mutationtest.execute;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.pitest.mutationtest.LocationMother.aMutationId;
Expand Down Expand Up @@ -85,7 +86,7 @@ public void setup() {
@Test
public void shouldReportNoErrorWhenNoMutationsSupplied() {
this.testee.run();
verify(this.reporter).done(ExitCode.OK);
verify(this.reporter, atLeastOnce()).done(ExitCode.OK);
}

@Test
Expand Down