getsentry / getsentry/self-hosted
Replay `recording-segments` endpoint deadlocks intermittently
- Dominant language
- Shell
- Stars
- 9.6k
- Forks
- 2k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 12
Description
### Self-Hosted Version
26.4.1
### CPU Architecture
x86_64
### Docker Version
29.4.1
### Docker Compose Version
v5.1.3
### Machine Specification
- [x] 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///).
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_
Contributor guide
Research direction
Start by reproducing the recording-segments endpoint calls against a fresh self-hosted Sentry 26.4.1 install with the filesystem filestore, then inspect the endpoint's streaming behavior around the opening '[' response. Use the nginx 30-second timeout and the effect of restarting the web container as diagnostic signals. Done means repeated requests return the complete streaming JSON payload within roughly 100–200 ms without requiring a web restart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, nginx
- Domain
- api, backend, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100