﻿# MPI error handlers: returning an error does not establish fault containment

Distinguish communicator error-handler scope, returned status and implementation abort behavior before claiming that one failed subgroup can safely continue.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/mpi-communicator-error-scope/
Language: en

A subgroup installs MPI_ERRORS_RETURN and the application assumes a failed collective will become an ordinary local exception while other subgroups continue. The setting changes error reporting, but it does not by itself repair membership, restore buffers or guarantee that the MPI program can safely proceed.

## Attach the policy to the right object

The [communicator error-handler reference](https://docs.open-mpi.org/en/main/man-openmpi/man3/MPI_Comm_set_errhandler.3.html) describes attaching a handler to a communicator. MPI also has other communication objects with their own error-handling context. Record the actual object used by the failing operation and the effective handler. Setting a policy on an unrelated communicator cannot establish the desired behavior. Preserve the operation's error result separately from the application's generic task failure message, which may omit the relevant communication scope.

## Read what returning an error promises

MPI_ERRORS_RETURN returns an error code to the application. The reference explicitly warns that MPI does not guarantee continuation past an error. A successful return to host code is therefore not a repaired distributed state. Other members may have different observations or still be waiting. The [communicator progress guide](/journal/guide-perf-nccl-ras-count-skew/) explains why one process's observation cannot establish completion or health of every participant in the intended group.

## Inspect abort behavior separately

The [MPI_Abort reference](https://docs.open-mpi.org/en/main/man-openmpi/man3/MPI_Abort.3.html) describes a best attempt to abort a communicator's group, then warns that the checked Open MPI implementation terminates the entire job. Do not infer application fault isolation solely from passing a subgroup communicator. Preserve implementation and version when defining an abort policy. General interface wording and actual implementation limits are separate evidence, especially when several logically independent jobs or services were placed inside one MPI launch for convenience.

## Do not reuse uncertain communication state

After a failed collective, an application must know whether buffers, requests and participant membership are valid before another operation. Ordinary error reporting supplies no general repair recipe. The [ReCoVer study](/journal/recover-constant-microbatch-forward-recovery-membership-epochs/) uses specialized membership and gradient repair, illustrating additional protocol work beyond returning an error. Its research result should not be transferred to a standard communicator merely because both paths expose a failure code to application logic.

## Test only a supported failure fixture

In a disposable program, choose a documented, controlled error case for the selected MPI implementation and record each participant's handler, return path and termination outcome. Avoid undefined application behavior as evidence of supported recovery. Verify the configured job manager's resulting state as well. Acceptance should explain the actual reporting and containment boundary. It does not establish arbitrary node-failure recovery or justify deliberately corrupting buffers and then interpreting a surviving process as proof of correctness.

## Choose a clear application response

Define whether the supported response is coordinated termination and restart, a documented fault-tolerant extension or another independently validated recovery mechanism. Preserve checkpoints and external output identities according to that choice. The bounded conclusion is that the selected error reaches the intended policy and produces an understood outcome. It is not automatic subgroup repair, transactional rollback or guaranteed continuation from any communication failure, and a narrower communicator name must not become an unsupported promise about which processes survive an abort.
