Skip to content

Cancelling a backup ends in ERROR instead of CANCELLED #152

Description

@eliasbakken

Found testing v1.1.0-RC8-2-g23a2bb6 on A8 s/n 0498.

Repro

Install selector, then Backup, label claude-backup-test, then Backup, then Cancel after ~25 s.

What happens

The UI returns to idle. The server state is ERROR:

[info] Backup cancelled after 0 minutes and 27 seconds
[info] Mounting /dev/sda2 on /mnt/usb as ro
[error] [mount-unmount-usb mounted ro]: exit status 32: umount: /mnt/usb: target is busy.
[error] [backup-emmc /mnt/usb/images/claude-backup-test]: exit status 137:
[info] Mounting /dev/sda2 on /mnt/usb as ro
[error] Error encountered during backup: ...

get_progress: "state":"ERROR","error":"An error was encountered during backup. Check log for details".

The open tab had already stopped polling (it saw CANCELLED then IDLE), so the error surfaces later: on a page reload, or to STATUS on the control protocol (flasher-pi).

Why

cancelBackup sets CANCELLED before the kill, and goBackup checks for CANCELLED under the lock. But getProgress turns CANCELLED into IDLE on the next poll (unlocked). The killed pipeline takes longer than one 1 s poll to exit, so goBackup sees IDLE and records ERROR. The same getProgress transition also runs mountUsb(MODE_RO) while the backup still has the file open ("target is busy").

Suggested direction

Do not let getProgress consume CANCELLED while the worker goroutine is still running. Let the worker own the final transition, or track "worker done" separately.

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