Skip to content

feat(apps): stop apps gracefully within their declared drain timeout #651

Backlog

Description

@RentnerKev

Problem

Apps declare resources.drainTimeoutMs (Monitoring: 2000), but the platform never reads it.

  • Stopping an app sends SIGKILL to its process group at once (core/src/app_ipc/process.rs:373-384). There is no SIGTERM in app_ipc or app_manager, and the launch frame (core/src/app_manager/runtime.rs:308-318) carries only startupTimeoutMs and processLimit.
  • Apps cannot finish in-flight requests, flush outboxes or close transactions on update, stop or uninstall.
  • App stdout and stderr go to /dev/null (process.rs:317-318), so a crashing app leaves no trace for the Owner.

Proposal

  • Pass drainTimeoutMs to the broker. On stop, send SIGTERM, wait up to the declared timeout, then SIGKILL the process group.
  • Keep the last 64 KiB of stderr per generation in memory and show it to the Owner after a crash.

Decision (2026-12-01)

Keep a bounded crash log: the last 64 KiB of stderr per generation, in memory only, readable only by the Owner, dropped on purge. stdout stays discarded.

Acceptance

  • Test: an app that handles SIGTERM exits cleanly within its drain timeout; an app that ignores it is killed after the timeout.
  • Test: after a crash the Owner sees the last stderr output, other users do not, and purge removes it.

Found in the app platform audit of 2026-11-30.

Activity

  1. added
    enhancement
    area: runtime
    on Nov 30, 2026
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

    area: runtimeenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions