Skip to content

F-31: JMRI heartbeat task deleted from outside, possibly mid-send #34

Open

Description

@bazauto

Severity: MEDIUM · Effort: Small · Batch: 2 · Status: Code done in #21 (68452a5), awaiting bench verification

Found in the second full review of the firmware. Recorded with the rest of the pass (F-19…F-44) in docs/REVIEW_REMEDIATION_PLAN_2.md, which is where its status is kept.

Description

JmriJsonClient::stopHeartbeat calls vTaskDelete on a task that may be inside
esp_websocket_client_send_text, holding the client's lock — the F-02 shape again. It is
called from both the WebSocket task and disconnect() with an unguarded handle, so the same
handle can be deleted twice. The task's stack is 2 KB with ESP_LOG in its path.

Plan

Cooperative shutdown with an exit signal, as F-02 did for the WiThrottle receive task, and a
3 KB stack pending F-33's measurement.

Acceptance Criteria

  • The task is woken to exit by a notification, signals, and suspends itself;
    stopHeartbeat() deletes it only after that signal, under a mutex that also guards
    startHeartbeat().
  • Stack raised to 3 KB.
  • Bench: repeated JMRI JSON connect/disconnect (twenty cycles) with no hang and no heap
    growth.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions