Skip to content

MPI_FILE_OPEN's ierr is never checked, so a failed open surfaces as an unexplained crash later #1903

Description

@sbryngelson

Symptom

A production segment died mid-run with no usable diagnostic. It took a long time to even establish that the failure was in file I/O rather than in the solver.

Cause

Every MPI_FILE_OPEN call site passes ierr and then ignores it. On master:

  • src/simulation/m_start_up.fpp:311, 327, 343, 367, 444
  • src/simulation/m_bubbles_EL.fpp:452, 470, 506, 547, 1859, 1900, 1916

and the same pattern in pre_process and post_process. When an open fails — a filesystem hiccup, a missing checkpoint, a quota or a metadata-server timeout, all routine at scale — execution continues with an invalid handle and the failure surfaces somewhere else entirely, or as a segfault.

Fix

Check ierr after each open and abort through s_mpi_abort naming the file and the MPI error string. Mechanical, but it converts a class of "the run died and we don't know why" into a one-line message.

Note

I do not have a reproducer — the original failure has not recurred — so this is filed on the code path rather than on a test case. The argument does not depend on the reproducer: an unchecked error code on a file open is worth closing on its own.

Found with Claude Code on OLCF Frontier.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions