Skip to content

MPI/job-array RunInstances ClientToken is derived from --job-array-name, not the per-launch array ID: relaunching a name fails IdempotentParameterMismatch (or could return the old reservation) #691

Closed

Description

@scttfrdmn

Symptom

On spawn 0.118.0 (0359c93), relaunching an MPI job array under a name already used earlier the same day failed within 5 s for every member. Nothing launched; the drain correctly found nothing.

spawn launch gchp-spawn-smoke --count 2 --job-array-name gchp-spawn-smoke --mpi --efa ... (c8g.48xlarge, us-east-1)
job array launch failed (2/2 members):
  gchp-spawn-smoke-0: terminal/IdempotentParameterMismatch at phase=launch-acked after 1 rung(s)
  gchp-spawn-smoke-1: terminal/IdempotentParameterMismatch at phase=launch-acked after 1 rung(s)

The earlier launch was the #671 smoke at 2026-10-04 04:24Z. This one was at 23:01Z, about 18.5 h later, with different user-data.

Cause

cmd/launch_jobarray.go, in the member loop of reconcileArrayMembers:

intent, err := cohort.NewEntityIntent(mp.name, id, "g1", cohort.CohortID(jobArrayID), ..., "")

The token argument is empty, so cohort's NewEntityIntent falls back to Token(cluster, string(id), string(gen)), which here is Token(<job-array-name>, <name>-<index>, "g1"). The per-launch jobArrayID (generateJobArrayID, which has the date and random suffix) is passed as the CohortID but is not part of the token. mpicohort.Actuator.Launch then sets cfg.ClientToken = intent.IdempotencyToken on RunInstances.

So two separate spawn launch invocations with the same --job-array-name send the same RunInstances ClientToken per index. Within EC2's token retention window:

  1. Parameters differ (new user-data, type, AZ, …) → IdempotentParameterMismatch, and the whole cohort fails. This is what I hit. It's harmless, but confusing, and the retry advice ("verify with spawn instances list") points in the wrong direction.
  2. Parameters identical → EC2 returns the original reservation instead of launching. If the first launch's instances are already terminated, spawn would get back dead instance IDs for a "successful" launch. If they're still running, two arrays share instances. I haven't reproduced this one; it follows from EC2's documented idempotency semantics.

Re-issuing a token is right within one launch: retries and AZ-fallback rungs of the same reconcile. It's wrong across launches.

Suggested fix

Include the per-launch jobArrayID in the token, e.g. cohort.Token(jobArrayID, string(id), "g1"), or pass it as the explicit token argument. Retries inside one reconcile keep a stable token, and separate launches get distinct ones. spawn array retry passes the original rec.ArrayID, so it would still regroup and stay idempotent against its own earlier attempt. That's worth a test, along with: two launches with the same name produce different tokens; a retry inside one reconcile produces the same token.

Workaround

Use a fresh --job-array-name per launch.

Confirmed working on 0.118.0 (hardware, for the #672 note)

2× c7g.large, --mpi, no EFA, gchp-spawn-plumb (first use of that name):

Minor, same run: --ttl 30m renders in --estimate-only as TTL cost: $0.07 (0 hr × 2 instances). The dollar figure is right but the hours read 0; probably integer truncation in the formatter.

Activity

  1. added a commit that references this issue on Oct 4, 2026
    946fcac
  2. added 3 commits that reference this issue on Oct 5, 2026
    d1cb3e3
    beee80a
    c3be672
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