PHANTOM
🇮🇳 IN
Skip to content

bug: SQS ReceiveMessage causes memory leak with frequent polling #13631

@arnoldas-jakstas-tg

Description

@arnoldas-jakstas-tg

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

LocalStack SQS exhibits unbounded memory growth when handling high-frequency ReceiveMessage polling. Tested w/ latest versions (4.12.0).

Image

Expected Behavior

Memory usage should stabilize after initial queue creation and remain constant during continuous polling. Empty ReceiveMessage requests should not accumulate state or leak memory, as request/response objects should be garbage collected after completion.

How are you starting LocalStack?

Custom (please describe below)

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

localstack is deployed via Helm to a Kubernetes cluster.

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

To mimic a similar setup:

  1. Create 20+ SQS queues (empty queues, no messages)
  2. Start 20+ worker processes that continuously poll their respective queues:
  3. Each worker polls one specific queue
  4. Use ReceiveMessage with WaitTimeSeconds=5 (long polling)
  5. Poll every 5 seconds continuously
  6. Queues remain empty (no messages sent)

Environment

- OS:
- LocalStack:
  LocalStack version: 4.12.0
  LocalStack Docker image sha: docker.io/localstack/localstack@sha256:0df3a97da57de03a588c05d9b8f390f15c7033fc7c4512f94619d344bc3cd317
  LocalStack build date: 2025-12-11
  LocalStack build git hash: b570b3ee2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws:sqsAmazon Simple Queue Servicestatus: backlogTriaged but not yet being worked ontype: bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions