Skip to content

flake: /rest/execute answered HTTP 400 "Session closed" on linux-arm64 TCG (nic-properties.test.ts) #374

Backlog

Description

@mobileskyfi

What happened

Main's integration run for the #368 merge (46773876279) failed on one leg, linux/aarch64 (TCG, CHR 7.25.2 arm64). test/integration/nic-properties.test.ts failed in assertPorts() → reported() → chr.exec():

QuickCHRError: exec failed (HTTP 400): {"detail":"Session closed","error":400,"message":"Bad Request"}
  code: "EXEC_FAILED"
  at restExecute (src/lib/exec.ts:69:9)
  at async restExecuteWithRetry (src/lib/exec.ts:121:17)
  at async exec (src/lib/quickchr.ts:1630:18)
  at async reported (test/integration/nic-properties.test.ts:76:27)

It happened 34.6 s into the test, which restarts machines ("after a restart too"). Every other leg of that run passed, and #368 touches neither exec nor NIC properties. This is the first time this was seen; there's no earlier issue and nothing in the docs about Session closed.

Open question

Is Session closed a transient RouterOS answer, e.g. a console session torn down while the guest is still settling after a boot under TCG, that restExecuteWithRetry() should retry like a transport failure? Or does it mean the command may have run, so retrying is unsafe? The answer decides the fix.

Waiting on

A recurrence, or a grounded reproduction of when RouterOS answers /rest/execute with Session closed. The failed leg was rerun to restore the freshness gate. If the rerun also fails, this becomes P1, since a red main blocks every PR.

Done-when

The cause is known and either restExecuteWithRetry() handles it (with a unit test on the classification), or the test waits on the condition that causes it. The finding goes in routeros-rest.instructions.md.

Activity

  1. added
    bug
    area:rest
    P3
    waiting
    P1
    and removed
    P3
    waiting
    on Dec 2, 2026
  2. mobileskyfi commented on Dec 2, 2026

    @mobileskyfi
    ContributorAuthor

    It recurred, so this is now P1. The rerun of the failed leg (job 143131797796) failed at the same place:

    • nic-properties.test.ts, first boot, exec for ether2 (ether1's assertion had passed, 1 expect() calls);
    • HTTP 400 Session closed;
    • 34.65 s into the test, against 34.64 s the first time.

    Main is red, so the required Integration freshness check blocks every PR (including #373).

    What I checked:

    • The last green run, 46757212240 at 00a7f31 (the commit before research(lab): QEMU netfilters for link impairment (#339) #368), passed this test on linux-arm64. Its environment matches the red runs exactly: ubuntu-24.04-arm image 20261111.635, QEMU 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18), Bun 1.4.4, CHR 7.25.2 arm64.
    • research(lab): QEMU netfilters for link impairment (#339) #368's src/ change is in credentials.ts (realpath keys), secrets.ts (lock release retry) and cli/index.ts (the provisioning-window check on an attached start). Nothing obviously touches /rest/execute.
    • Locally at dd18f20 (KVM host, arm64 CHR under TCG, QEMU 11.1.2), the same six-NIC machine answers every exec correctly (ether1…ether6 all as expected). It doesn't reproduce outside CI.

    Next steps, not taken yet: run nic-properties.test.ts alone on linux-arm64 at dd18f20 and at 00a7f31 (gh workflow run integration.yml --ref <sha> -f platforms=linux-arm64 -f test-filter=nic-properties.test.ts), to tell a #368 regression from an ordering or runner effect. Then decide whether restExecuteWithRetry() should treat Session closed as transient.

  3. mobileskyfi commented on Dec 2, 2026

    @mobileskyfi
    ContributorAuthor

    Bisect so far (linux-arm64, -f platforms=linux-arm64):

    run ref files result
    46796489492 00a7f31 nic-properties alone pass
    46796496980 dd18f20 nic-properties alone pass
    46797107963 00a7f31 full suite pass
    46805937892 dd18f20 credential-files, credential-propagation, nic-properties pass
    46805947287 dd18f20 the other 18 earlier files, then nic-properties pass

    Main at dd18f20 failed twice, 23:53 and about 01:05 UTC, at 34.6 s both times. Every run since has passed, at either commit. Neither half of the preceding files reproduces it alone. So the evidence now favours a time-correlated runner condition over a #368 regression, though a cross-half interaction isn't ruled out. Main's failed leg is being rerun a third time. If it passes, this goes back to waiting and P3: the open question about whether Session closed is transient for /rest/execute stays, with these runs as the evidence.

  4. added
    P3
    waiting
    and removed
    P1
    on Dec 2, 2026
  5. mobileskyfi commented on Dec 2, 2026

    @mobileskyfi
    ContributorAuthor

    The third rerun of main's linux-arm64 leg passed (run 46773876279, attempt 3), so main is green again, and #373 merged on it. Every run since the two failures has passed (table above), so this goes back to P3 / waiting. What it waits on: another Session closed from /rest/execute, or a grounded reproduction. Then decide whether restExecuteWithRetry() should treat it as transient. The probe/374-* branches are deleted.

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

    P3area:restbugwaiting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions