Skip to content

Attachments:AddTimeout over about 49.7 days passes the startup check and makes each upload throw #537

Open

Description

@pdevito3

Summary

Attachments:AddTimeout has a lower bound and no upper bound. A value over about 49.7 days passes the startup check, and then each attachment add throws ArgumentOutOfRangeException from CancelAfter.

Where

Main at 3b7a3c7122b9a3dd4a18c66c85640be95913ce4a.

Reproduction steps

  1. Set Attachments__AddTimeout=50.00:00:00 on the Server.
  2. Start the stack. The Server starts with no error.
  3. Upload a file to a workshop on its detail page.

A unit test can call AttachmentOptions.From with that value and assert that it throws.

Expected

The Server refuses to start, and the message names Attachments:AddTimeout and its largest value.

Actual

The Server starts, and each upload fails with a 500 from ArgumentOutOfRangeException.

Impact

A wrong setting breaks every upload, and the error does not name the setting. A large value also makes the sweep grace so long that the sweep keeps every orphan.

Source

Finding L4, bound half, in the review comment of #526: #526 (comment)

Suggested fix

Refuse an AddTimeout over a sane upper bound in AttachmentOptions.From, for example one hour, and at most the limit of CancelAfter.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions