Skip to content

Cancelling a file upload reports a USB drive failure and leaves the drive mounted rw #151

Description

@eliasbakken

Found testing v1.1.0-RC8-2-g23a2bb6 on A8 s/n 0498, over Ethernet. Related to #114 and #118, but a different path.

Repro

File upload, 300 MB file, press Cancel at ~75%.

What happens

Two red, sticky toasts:

The upload failed while writing to the USB drive. Check that it is present and has free space.

Log:

[info] Closing file
[info] Upload cancelled by the user after 0 minutes and 24 seconds
[error] Could not write a chunk of the upload to <file> after 235929600 of 314572800 bytes (75%): invalid argument
[error] Could not write a chunk of the upload to <file> after 235929600 of 314572800 bytes (75%): invalid argument

Network: the in-flight upload_chunk returns 500, then upload_cancel. get_progress ends at state: ERROR.

Why

uploadCancel closes state.File and sets it to nil while a chunk admitted by beginChunk() is still in writeChunk. The write then hits a closed/nil *os.File (invalid argument), and failChunk sets ERROR with the USB-drive message. The drain that protects against the watchdog (#118) does not apply to the cancel path.

Side effect

The state ends as ERROR, not CANCELLED, so getProgress never runs the mountUsb(MODE_RO) it does for CANCELLED. /mnt/usb stayed rw until the next options save remounted it ro.

Suggested direction

Have uploadCancel mark cancelled first, then wait for in-flight chunks (same as the watchdog) before closing the file. A write failure after the cancel should count as cancelled, not as a drive fault.

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