Skip to content

Conversation

MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Oct 13, 2025

Move oidc.load_metadata() startup into _base.start().

Dev notes

oidc.load_metadata() introduced in matrix-org/synapse#7256

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

Comment on lines +628 to +636
# Load the OIDC provider metadatas, if OIDC is enabled.
if hs.config.oidc.oidc_enabled:
oidc = hs.get_oidc_handler()
# Loading the provider metadata also ensures the provider config is valid.
#
# FIXME: It feels a bit strange to validate and block on startup as one of these
# OIDC providers could be temporarily unavailable and cause Synapse to be unable
# to start.
await oidc.load_metadata()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this lived in synapse/app/homeserver.py -> setup() which is only for the SynapseHomeServer (main Synapse instance).

This has now moved to _base.start() which means it will run on workers and the main Synapse instance.

I can't really tell if this should be only be run on the main instance or not. Kinda feels like we should validate the provider config on any Synapse instance. This will cause every instance to contact the providers to fetch the metadata.

handle_startup_exception(e)

async def _start_when_reactor_running() -> None:
# TODO: Feels like this should be moved somewhere else.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that the correct conclusion is that this belongs only on the main Synapse instance (see #19056 (comment)). In that case, this PR should just remove this TODO with some context on why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant