The Missing Torque Calibration

Hard

· Backend

Incident

SEV-1

BUG-A400M

Priority: Critical (safety) · reported by flight test

Time to fix: 35 min

Failing checks on the shipped build

  • three erased engines are NO-GO

    erased calibration must ground the aircraft: expected NO-GO: engines 1,2,3 but got GO

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Inspired by

Airbus A400M · 2015

Modelled on the Airbus A400M crash near Seville on 9 May 2015. On a pre-delivery test flight, three of the aircraft's four engines did not respond correctly after take-off and the aircraft crashed, killing four of the six crew. Airbus later said that torque calibration parameter data had been accidentally wiped from the engine control units of three engines during software installation, leaving those engines unable to operate as commanded, and the missing data was not flagged before take-off.

This reconstruction's CalibrationLoader reads each engine's parameter file. A missing parameter quietly becomes 0, so the preflight check sees a "calibration" for every engine and signs off.

Fix the loader so a missing, blank or unreadable parameter can never be flown on.

Code map

class CalibrationLoader {
    static Calibration load(EngineFile file) {
        double gain = read(file, "torque.gain");
        double offset = read(file, "torque.offset");
        return new Calibration(gain, offset);
    }

    static double read(EngineFile file, String key) {
        String raw = file.values.getOrDefault(key, "0");
        return Double.parseDouble(raw.trim());
    }
}

Sign in to edit the file, run the tests and submit a fix

A free account — no card, no trial clock. You come straight back here.

The Missing Torque Calibration — Java Bug Hunt

Modelled on the Airbus A400M crash near Seville on 9 May 2015.

  • Language: Java
  • Layer: Backend
  • Difficulty: Hard
  • Concepts: Config, Safety, Validation
  • Modelled on: Airbus A400M · 2015
  • Visible tests: a complete calibration loads; four calibrated engines are GO; three erased engines are NO-GO
  • Reward: 50 XP for a complete fix

Incident

  • Severity: SEV-1 (priority: Critical (safety))
  • Ticket: BUG-A400M
  • Reported by: flight test
  • Time to fix: 35 minutes, the target for a hard incident

Failing checks on the shipped build

  • three erased engines are NO-GO — erased calibration must ground the aircraft: expected NO-GO: engines 1,2,3 but got GO

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Briefing

Modelled on the Airbus A400M crash near Seville on 9 May 2015. On a pre-delivery test flight, three of the aircraft's four engines did not respond correctly after take-off and the aircraft crashed, killing four of the six crew. Airbus later said that torque calibration parameter data had been accidentally wiped from the engine control units of three engines during software installation, leaving those engines unable to operate as commanded, and the missing data was not flagged before take-off.

This reconstruction's CalibrationLoader reads each engine's parameter file. A missing parameter quietly becomes 0, so the preflight check sees a "calibration" for every engine and signs off.

Fix the loader so a missing, blank or unreadable parameter can never be flown on.

Bug report

BUG-A400M · Priority: Critical (safety) · Reported by: flight test

CalibrationLoader.load(file) builds a Calibration from the parameters "torque.gain" and "torque.offset":

  • each value is parsed as a double (surrounding whitespace allowed)
  • a parameter that is missing, blank, or not a number must make load() throw IllegalStateException naming the parameter — never a default of 0, never a NumberFormatException
  • Preflight.check(engines) (locked) relies on that: it answers "GO" only when every engine loads, otherwise "NO-GO: engines 1,2,3" (1-based)

Observed: three engines with erased calibration files pass preflight as "GO"; in flight their torque commands come out as raw * 0 + 0.

Logs

[ecu-1] load torque.gain=<absent> torque.offset=<absent>
[preflight] engines 1-4 calibrated: GO
[ecu-1] torque command 0.0 for throttle 92%

The code as shipped

src/engine/CalibrationLoader.java (editable)

class CalibrationLoader {
    static Calibration load(EngineFile file) {
        double gain = read(file, "torque.gain");
        double offset = read(file, "torque.offset");
        return new Calibration(gain, offset);
    }

    static double read(EngineFile file, String key) {
        String raw = file.values.getOrDefault(key, "0");
        return Double.parseDouble(raw.trim());
    }
}

Read-only context: src/engine/Calibration.java, src/engine/Preflight.java.

Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More Java bug hunts.