apache/hadoop · error · RuntimeException

CumulativeCpuUsageEmulatorPlugin got interrupted. Exiting.

Error message

CumulativeCpuUsageEmulatorPlugin got interrupted. Exiting.

What it means

In CumulativeCpuUsageEmulatorPlugin's midlock-adjustment loop, the plugin calls emulatorCore.compute() and Thread.sleep(100) until CPU usage reaches the progress-weighted target. If the thread is interrupted during that sleep it converts the InterruptedException into a RuntimeException with this message. Interruption here is Hadoop's normal mechanism for cancelling a task attempt, so this usually means the simulated task was killed or aborted, not that CPU emulation is broken.

Solutions

  1. Treat the exception as expected cancellation when you intentionally killed the job; no fix needed for the simulation itself
  2. Raise task timeouts (mapreduce.task.timeout) so CPU-emulating tasks are not interrupted by the framework mid-emulation
  3. If you maintain this code, restore the interrupt flag and throw a quieter checked path instead of RuntimeException
Defensive patterns

Strategy: try-catch

Try / catch

try {
  plugin.middleware... // run job with CPU emulation
} catch (RuntimeException e) {
  if (e.getMessage() != null && e.getMessage().contains("got interrupted")) {
    // task was cancelled (kill/abort); treat as shutdown, restore interrupt flag
    Thread.currentThread().interrupt();
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Killing/aborting the gridmix job or task attempt while a CPU-emulation map task is inside its 100ms sleep; task timeout leading the framework to interrupt the task thread; cluster shutdown interrupting running simulated tasks.

Common situations: 'hadoop job -kill' or YARN application kill during a gridmix run with resource emulation enabled (gridmix.emulators.resource-usage.plugins including the CPU plugin); long CPU-emulation tasks exceeding task timeouts; JVM reuse scenarios where interrupts leak between tasks.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/4275e0813f0b0a48. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/emulators/resourceusage/CumulativeCpuUsageEmulatorPlugin.java:285

        long projectedUsage = 
          currentCpuUsage + (long)((1 - currentProgress) * rate);
        
        if (projectedUsage < targetCpuUsage) {
          // determine the correction factor between the current usage and the
          // expected usage and add some weight to the target
          long currentWeighedTarget = 
            (long)(targetCpuUsage 
                   * getWeightForProgressInterval(currentProgress));
          
          while (getCurrentCPUUsage() < currentWeighedTarget) {
            emulatorCore.compute();
            // sleep for 100ms
            try {
              Thread.sleep(100);
            } catch (InterruptedException ie) {
              String message = 
                "CumulativeCpuUsageEmulatorPlugin got interrupted. Exiting.";
              throw new RuntimeException(message);
            }
          }
        }
        
        // set the last seen progress
        lastSeenProgress = progress.getProgress();
        // set the last seen usage
        lastSeenCpuUsage = getCurrentCPUUsage();
      }
    }
  }

  @Override
  public void initialize(Configuration conf, ResourceUsageMetrics metrics,
                         ResourceCalculatorPlugin monitor,
                         Progressive progress) {
    this.monitor = monitor;
    this.progress = progress;

View on GitHub (pinned to 2add963021)