Reproduction steps
- On the Android app, open a channel on a self-hosted instance with a raised upload limit (here 1 GB).
- Attach a large file (e.g. 750 MB; also happens from ~100 MB) on a normal home connection (~50 Mbit/s upload).
- Send it and watch the upload progress.
Expected behaviour
If one upload part fails on a brief network hiccup, the app retries that part and the file finishes uploading and gets sent.
Actual behaviour
The progress bar reaches the end, then resets to 0 and starts over, forever. The file is never sent. Server logs show 18 of 20 parts succeeding; one part got a 502 and one a 400, and the app never retried either one. It never calls /attachments/complete and restarts the whole upload instead. The web client retries each part up to 4 times and doesn't have this problem.
Build information
Version 2026.11.100, Channel Stable, Build 3021, Android 17 (arm64), Device Xiaomi 2602EPTC0G, Locale hu-HU, Push fcm, Flutter 3.47.9, Dart 3.13.7
Platform
Android
Evidence
Running 2026.1111.31735 self-hosted, Android app (Dart/3.13). Test file was 756 MB, which the app splits into 20 parts of ~38 MB and uploads 4 at a time.
From the media-proxy logs on one attempt: 18 parts went through fine (200, about 20-45s each). Part 2 failed with a 502, and the relay logged "S3 PUT failed ... received fatal alert: BadRecordMac", so just a random TLS hiccup to R2. Part 5 got a 400 "request rejected" after about 10s, which looks like the app's body stream cut out early.
After that the app never retried those two parts and never called /attachments/complete. It just started the whole upload over from 0, and that keeps happening forever.
Looking at attachment_upload_client.dart, the parts are sent with a plain _uploadDio.put on a one-shot file stream and there's no retry per part. So on a slow-ish connection, one bad part out of 20 kills the whole thing. The web client retries parts and works fine.
Probably the fix is to retry failed parts a few times with backoff (reopening that file range), keep the parts that already finished, and show an error if it really can't upload instead of looping.
Side note on the server side: the relay's buffered retry doesn't count TLS errors like BadRecordMac as retryable, even though it could just resend the buffered part.
1 comment
Comment by Rex