element-hq / element-hq/synapse

Setting rate limits to 0 can confuse clients into infinite send loop

Open
#9,331 0 comments 0 reactions 0 assignees View on GitHub
S-Minor T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

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

---

### Description

I wanted to disable all Synapse send rate limits for local development. I tried:

```yaml
rc_messages_per_second: 0
rc_message_burst_count: 0
```

After restarting and trying to send a message, Synapse would reply with:

```json
{
"errcode": "M_LIMIT_EXCEEDED",
"error": "Too Many Requests",
"retry_after_ms": -1612545994091
}
```

The negative `retry_after_ms` value may lead to unexpected client behaviour. Element Web has [been fixed](https://github.com/matrix-org/matrix-js-sdk/pull/1591) just now, but prior to that it would retry infinitely with no delay. 😱

### Steps to reproduce

- Set the ratelimiting config above
- Send a message
- Receive an unexpected negative `retry_after_ms` value in the error reply

### Version information

- **Homeserver**: Local dev server
- **Version**: 1.25.0 (b=develop,21a296cd5,dirty)
- **Install method**: `pip install -e .` from Git clone
- **Platform**: macOS 10.15.7 with Python 3.8.6

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.