element-hq / element-hq/synapse

Split appservice transactions up when an AS responds with 413 Entity Too Large

Open
#15,294 0 comments 0 reactions 0 assignees View on GitHub
A-Application-Service O-Occasional S-Major T-Task
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#15294](https://github.com/matrix-org/synapse/issues/15294).

---

Because it's tribal knowledge around ASes that you should set a sensibly healthy maximum client body for transactions, people often don't. Nginx sets a max body size of 1MB by default, which is unhelpfully pitifully small.

When Synapse encounters a 413, it just tries to resend the request ad infinitum rather than trying to split the request up into smaller chunks. What would be nice is if Synapse split the txn up and retried it, queuing the other half of the original transaction as the next logical block. However, this has it's own problems like trying to determine the maximum size by guessing..

Either way, perhaps we should be more intelligent about 413s than simply resending them and hoping the LB has been reconfigured.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by tracing Synapse's application-service transaction sending and 413 retry handling, then determine how transaction splitting and queuing should work; done means oversized transactions are retried in smaller logical blocks without infinite resends.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.