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

Fix @tag_args being off-by-one (ahead) #13452

Merged
merged 7 commits into from
Aug 4, 2022

Commits on Aug 4, 2022

  1. Fix @tag_args being off-by-one (ahead)

    Example:
    
    ```
    argspec.args=[
      'self',
      'room_id'
    ]
    
    args=(
      <synapse.storage.databases.main.DataStore object at 0x10d0b8d00>,
      '!HBehERstyQBxyJDLfR:my.synapse.server'
    )
    ```
    MadLittleMods committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    948090f View commit details
    Browse the repository at this point in the history
  2. Add changelog

    MadLittleMods committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    a988d5f View commit details
    Browse the repository at this point in the history
  3. Fix flawed logic iterating of args

    See #13452 (comment)
    
    The previous logic is flawed and we can end up in a situation like this:
    
    ```
    argspec.args=['self', 'dest', 'room_id', 'limit', 'extremities']
    
    args=(<synapse.federation.federation_client.FederationClient object at 0x7f1651c18160>, 'hs1', '!jAEHKIubyIfuLOdfpY:hs1')
    ```
    
    From this source:
    ```py
    async def backfill(
        self, dest: str, room_id: str, limit: int, extremities: Collection[str]
    ) -> Optional[List[EventBase]]:
    ```
    
    And this usage:
    ```py
    events = await self._federation_client.backfill(
        dest, room_id, limit=limit, extremities=extremities
    )
    ```
    
    Causes this error:
    ```
    synapse_main | 2022-08-04 06:13:12,051 - synapse.handlers.federation - 424 - ERROR - GET-5 - Failed to backfill from hs1 because tuple index out of range
    synapse_main | Traceback (most recent call last):
    synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation.py", line 392, in try_backfill
    synapse_main |     await self._federation_event_handler.backfill(
    synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 828, in _wrapper
    synapse_main |     return await func(*args, **kwargs)
    synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/handlers/federation_event.py", line 593, in backfill
    synapse_main |     events = await self._federation_client.backfill(
    synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 828, in _wrapper
    synapse_main |     return await func(*args, **kwargs)
    synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 827, in _wrapper
    synapse_main |     with wrapping_logic(func, *args, **kwargs):
    synapse_main |   File "/usr/local/lib/python3.9/contextlib.py", line 119, in __enter__
    synapse_main |     return next(self.gen)
    synapse_main |   File "/usr/local/lib/python3.9/site-packages/synapse/logging/tracing.py", line 922, in _wrapping_logic
    synapse_main |     set_attribute("ARG_" + arg, str(args[i + 1]))  # type: ignore[index]
    synapse_main | IndexError: tuple index out of range
    ```
    MadLittleMods committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    97ad363 View commit details
    Browse the repository at this point in the history
  4. Align indexes

    MadLittleMods committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    7e34d6d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7dcf6f7 View commit details
    Browse the repository at this point in the history
  6. Fix lints

    MadLittleMods committed Aug 4, 2022
    Configuration menu
    Copy the full SHA
    3389a23 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4152613 View commit details
    Browse the repository at this point in the history