@@ -205,8 +205,9 @@ private Results runRateLimitedMultiPhase() {
205
205
}
206
206
}
207
207
208
- // Go to next phase if this one is complete
209
- if (phaseComplete && !lastEntry ) {
208
+ // Go to next phase if this one is complete or enter if error was thrown
209
+ boolean errorThrown = testState .getState () == State .ERROR ;
210
+ if ((phaseComplete || errorThrown ) && !lastEntry ) {
210
211
// enters here after each phase of the test
211
212
// reset the queues so that the new phase is not affected by the
212
213
// queue of the previous one
@@ -355,19 +356,25 @@ private long getInterval(int lowestRate, Phase.Arrival arrival) {
355
356
356
357
@ Override
357
358
public void uncaughtException (Thread t , Throwable e ) {
358
-
359
- // HERE WE HANDLE THE CASE IN WHICH ONE OF OUR WOKERTHREADS DIED
359
+ // Here we handle the case in which one of our worker threads died
360
360
LOG .error (e .getMessage (), e );
361
- System .exit (-1 );
362
-
363
- /*
364
- * Alternatively, we could keep an HashMap<Thread,Worker> storing the
365
- * runnable for each thread, so that we can get the latency numbers from
366
- * a thread that died, and either continue or at least report current
367
- * status. (Remember to remove this thread from the list of threads to
368
- * wait for)
369
- */
370
-
361
+ // We do not continue with the experiment. Instead, bypass rest of
362
+ // phases that were left in the test and signal error state.
363
+ // The rest of the workflow to finish the experiment remains the same,
364
+ // and partial metrics will be reported (i.e., until failure happened).
365
+ synchronized (testState ) {
366
+ for (WorkloadConfiguration workConf : this .workConfs ) {
367
+ synchronized (workConf .getWorkloadState ()) {
368
+ WorkloadState workState = workConf .getWorkloadState ();
369
+ Phase phase = workState .getCurrentPhase ();
370
+ while (phase != null ) {
371
+ workState .switchToNextPhase ();
372
+ phase = workState .getCurrentPhase ();
373
+ }
374
+ }
375
+ }
376
+ testState .signalError ();
377
+ }
371
378
}
372
379
373
380
public static final class TimeBucketIterable implements Iterable <DistributionStatistics > {
0 commit comments