Skip to content
Snippets Groups Projects
  1. Oct 12, 2021
    • Sean Quah's avatar
      Fix opentracing and Prometheus metrics for replication requests (#10996) · 6b18eb44
      Sean Quah authored
      This commit fixes two bugs to do with decorators not instrumenting
      `ReplicationEndpoint`'s `send_request` correctly. There are two
      decorators on `send_request`: Prometheus' `Gauge.track_inprogress()`
      and Synapse's `opentracing.trace`.
      
      `Gauge.track_inprogress()` does not have any support for async
      functions when used as a decorator. Since async functions behave like
      regular functions that return coroutines, only the creation of the
      coroutine was covered by the metric and none of the actual body of
      `send_request`.
      
      `Gauge.track_inprogress()` returns a regular, non-async function
      wrapping `send_request`, which is the source of the next bug.
      The `opentracing.trace` decorator would normally handle async functions
      correctly, but since the wrapped `send_request` is a non-async function,
      the decorator ends up suffering from the same issue as
      `Gauge.track_inprogress()`: the opentracing span only measures the
      creation of the coroutine and none of the actual function body.
      
      Using `Gauge.track_inprogress()` as a context manager instead of a
      decorator resolves both bugs.
      6b18eb44
    • reivilibre's avatar
  2. Oct 11, 2021
  3. Oct 08, 2021
  4. Oct 07, 2021
  5. Oct 06, 2021
  6. Oct 05, 2021
    • David Robertson's avatar
      Fix potential leak of per-room profiles when the user dir is rebuilt. (#10981) · 4f00432c
      David Robertson authored
      
      There are two steps to rebuilding the user directory:
      
      1. a scan over rooms, followed by
      2. a scan over local users.
      
      The former reads avatars and display names from the `room_memberships`
      table and therefore contains potentially private avatars and
      display names. The latter reads from the the `profiles` table which only
      contains public data; moreover it will overwrite any private profiles
      that the rooms scan may have written to the user directory. This means
      that the rebuild could leak private user while the rebuild was in
      progress, only to later cover up the leaks once the rebuild had completed.
      
      This change skips over local users when writing user_directory rows
      when scanning rooms. Doing so means that it'll take longer for a rebuild
      to make local users searchable, which is unfortunate. I think a future
      PR can improve this by swapping the order of the two steps above. (And
      indeed there's more to do here, e.g. copying from `profiles` without
      going via Python.)
      
      Small tidy-ups while I'm here:
      
      * Remove duplicated code from test_initial. This was meant to be pulled into `purge_and_rebuild_user_dir`.
      * Move `is_public` before updating sharing tables. No functional change; it's still before the first read of `is_public`.
      * Don't bother creating a set from dict keys. Slightly nicer and makes the code simpler.
      
      Co-authored-by: default avatarRichard van der Hoff <1389908+richvdh@users.noreply.github.com>
      4f00432c
    • Eric Eastwood's avatar
      Fix logic flaw preventing tracking of MSC2716 events in existing room versions (#10962) · 392863fb
      Eric Eastwood authored
      We correctly allowed using the MSC2716 batch endpoint for
      the room creator in existing room versions but accidentally didn't track
      the events because of a logic flaw.
      
      This prevented you from connecting subsequent chunks together because it would
      throw the unknown batch ID error.
      
      We only want to process MSC2716 events when:
      
       - The room version supports MSC2716
       - Any room where the homeserver has the `msc2716_enabled` experimental feature enabled and the event is from the room creator
      392863fb
    • Brendan Abolivier's avatar
      Merge branch 'master' into develop · 2faac70e
      Brendan Abolivier authored
      2faac70e
Loading