Skip to content

SQS: MaximumMessageSize default is 256 KiB, AWS documents 1 MiB #439

Closed

Description

@scttfrdmn

Noticed while implementing #429.

getQueueAttributes reports MaximumMessageSize as 262144 (256 KiB) for a queue created without naming it:

"MaximumMessageSize": getAttrOrDefault(q.Attributes, "MaximumMessageSize", "262144"),

The current CreateQueue API reference documents the default as 1,048,576 bytes (1 MiB):

MaximumMessageSize – The limit of how many bytes a message can contain before Amazon SQS rejects it. Valid values: An integer from 1,024 bytes (1 KiB) to 1,048,576 bytes (1 MiB). Default: 1,048,576 bytes (1 MiB).

256 KiB was the historical SQS limit; AWS raised it. So a consumer reading this attribute back to size its own batching or to assert on a queue's configured limit gets a value real SQS has not returned for some time.

Why it is not fixed in #429

#429 added sqsAttributeDefaults, which deliberately mirrors getQueueAttributes' inline fallbacks rather than the AWS reference, so the CreateQueue attribute comparison and the read path cannot disagree about what a queue's effective attributes are. A comparison using different defaults than the read path would reject re-create requests naming exactly what a caller had just read back.

That means the stale value is currently consistent in both places, and correcting it is a separate, observable change to GetQueueAttributes output — not something to smuggle into an error-fidelity fix. emulator/sqs_createqueue.go carries // TODO(#N) pointing here.

Scope

  • Change the fallback in getQueueAttributes and the matching entry in sqsAttributeDefaults together, so they stay in lockstep.
  • Check whether anything enforces the limit on SendMessage — if a size check exists it must move with the default, and if none exists, note that rather than adding one here.
  • Verify the value against the CreateQueue reference at implementation time rather than trusting the number above.

Acceptance criteria

  • GetQueueAttributes reports the documented default for a queue created without the attribute.
  • sqsAttributeDefaults matches, and the TODO in sqs_createqueue.go is removed.
  • A test pins the value, so a future drift from the reference is caught.
  • Any SendMessage size enforcement is consistent with the new default, or its absence is documented.
  • docs/services.md SQS section states the default if it names one.

Activity

  1. added this to the v0.84.0 milestone on Aug 1, 2026
  2. scttfrdmn commented on Aug 1, 2026

    @scttfrdmn
    OwnerAuthor

    Fixed in #450, shipping in v0.84.0. GetQueueAttributes now reports 1048576 for a queue created without the attribute.

    Confirmed against the CreateQueue reference: "Valid values: An integer from 1,024 bytes (1 KiB) to 1,048,576 bytes (1 MiB). Default: 1,048,576 bytes (1 MiB)." 256 KiB is the historical limit, not the current default. An explicitly requested value is still honored — 256 KiB remains legal, it is simply no longer what a bare queue reports.

    Both default sites moved together and now share one constant: getQueueAttributes' inline fallback and the sqsAttributeDefaults map that CreateQueue's conflict check (#429) resolves an existing queue's unset attributes through. That coupling is load-bearing — if they diverged, GetQueueAttributes would report one number and a re-create naming exactly that number would be rejected as QueueNameExists. A named constant makes the divergence impossible rather than merely tested, and the idempotent-re-create test covers it either way. (Mutation-tested by reverting only the read path: it fails with QueueNameExists, exactly as predicted.)

    Scoping the part that did not change: substrate still does not enforce MaximumMessageSize on SendMessage — no length check exists against the attribute or any constant, so an oversized body is accepted. Per this issue's own acceptance criteria that absence is now documented in docs/services.md rather than left implicit. Enforcement is a new error path with its own scope (the exact error code needs confirming, and there are open questions about whether message attributes count toward the total and how batches are measured), so it is tracked separately as #454.

    The TODO(#439) in sqs_createqueue.go is removed.

  3. added a commit that references this issue on Aug 1, 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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions