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

_run_push_actions_and_persist_event re-starts a finished logging context when persist_events_and_notify raises an exception #12987

@squahtx

Description

@squahtx

When persist_events_and_notify raises an exception, we try to clean up push actions in a background task:

try:
await self.persist_events_and_notify(
event.room_id, [(event, context)], backfilled=backfilled
)
except Exception:
run_in_background(
self._store.remove_push_actions_from_staging, event.event_id
)
raise

run_in_background inherits the current logging context, but since we don't await the background task, we end up closing the logging context before the background task finishes. We ought to either await remove_push_actions_from_staging directly, or create a logging context for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FederationS-TolerableMinor significance, cosmetic issues, low or no impact to users.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions