Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix stack overflow in _PerHostRatelimiter due to synchronous requests #14812

Merged
merged 6 commits into from
Jan 13, 2023

Commits on Jan 10, 2023

  1. Add failing test

    Signed-off-by: Sean Quah <seanq@matrix.org>
    Sean Quah committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    523ae5e View commit details
    Browse the repository at this point in the history
  2. Add reactor parameter to _PerHostRatelimiter

    Signed-off-by: Sean Quah <seanq@matrix.org>
    Sean Quah committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    19151e1 View commit details
    Browse the repository at this point in the history
  3. Fix stack overflow in _PerHostRatelimiter due to synchronous requests

    When there are many synchronous requests waiting on a
    `_PerHostRatelimiter`, each request will be started recursively just
    after the previous request has completed. Under the right conditions,
    this leads to stack exhaustion.
    
    A common way for requests to become synchronous is when the remote
    client disconnects early, because the homeserver is overloaded and slow
    to respond.
    
    Avoid stack exhaustion under these conditions by deferring subsequent
    requests until the next reactor tick.
    
    Fixes #14480.
    
    Signed-off-by: Sean Quah <seanq@matrix.org>
    Sean Quah committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    5e4e918 View commit details
    Browse the repository at this point in the history
  4. Add newsfile

    Signed-off-by: Sean Quah <seanq@matrix.org>
    Sean Quah committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    4133e0d View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2023

  1. fixup: s/admit/allow through/

    Sean Quah committed Jan 12, 2023
    Configuration menu
    Copy the full SHA
    0189de5 View commit details
    Browse the repository at this point in the history
  2. fixup: use callLater instead of callFromThread

    Sean Quah committed Jan 12, 2023
    Configuration menu
    Copy the full SHA
    bd0a8f6 View commit details
    Browse the repository at this point in the history