Skip to content

Replay recording-segments endpoint deadlocks intermittently #4303

@Cappsyhun

Description

@Cappsyhun

Self-Hosted Version

26.4.1

CPU Architecture

x86_64

Docker Version

29.4.1

Docker Compose Version

v5.1.3

Machine Specification

  • My system meets the minimum system requirements of Sentry

Installation Type

Fresh Install

Steps to Reproduce

  1. Fresh self-hosted Sentry 26.4.1 install with default config (filesystem filestore).

  2. Set up a frontend with Sentry SDK and Replay enabled (e.g. sentry.javascript.angular@10.50.0).

  3. Trigger an error to capture a replay (4 segments, ~4 MB total in our case).

  4. Wait for ingest to complete (replay blobs visible at /data/files/30/<project_id>/<replay_id>/).

  5. Call the recording-segments endpoint 5 times in quick succession:

    for i in 1 2 3 4 5; do
    curl -s -o /dev/null -w 'req %{url_effective}: code=%{http_code} time=%{time_total}s bytes=%{size_download}\n'
    --max-time 35
    -H "Authorization: Bearer $TOKEN"
    "$BASE/api/0/projects/$ORG/$PROJ/replays/$RID/recording-segments/?cursor=0%3A0%3A0&download=true&per_page=100"
    sleep 1
    done

  6. Observe: most requests return code=200 but with bytes=1 and time=30s (nginx upstream timeout).
    The body contains only "[" — the streaming generator yields the opening bracket then hangs.

  7. docker compose restart web temporarily resolves it (first 1-2 requests succeed),
    but the issue returns after a few requests.

Expected Result

The recording-segments endpoint should consistently return 200 OK with the full
streaming JSON payload (~4 MB in our test case) within ~100-200 ms, regardless
of how many requests have been made since the last web container restart.
The streaming generator should yield all segments after the opening "[" byte,
not hang after it.

Actual Result

After 1-2 successful requests post-restart, subsequent requests return 200 OK
but with only 1 byte body (just "[") after exactly 30 seconds — the nginx
upstream timeout. The body is truncated because the streaming generator hangs
after yielding the opening bracket. Every subsequent request behaves the same
way until "docker compose restart web" is run, after which the cycle repeats.

Event ID

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions