Skip to content

fix(options): Read the silo-dependent model once in OptionsStore - #131740

Open
sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/options-store-silo-model-race
Open

sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/options-store-silo-model-race

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Refs DI-2898

OptionsStore.model returns Option or ControlOption depending on the current silo mode. get_store and get_last_update_channel read it twice: once for the query and again in the except clause. If another thread switches silo mode in between, the query raises Option.DoesNotExist, but the except is looking for ControlOption.DoesNotExist. The missing option then escapes as an error instead of being treated as a miss.

This showed up in Relay integration tests as intermittent 500s on /api/0/relays/projectconfigs/. The live server thread served Relay's global config fetch while the test's main thread was inside assume_test_silo_mode.

Both methods now read the model once and use it for both the query and the except. set_store and delete_store already read it once.

via @joshuarli.

--

View Session [Sentry]

OptionsStore.model follows the current silo mode. get_store and
get_last_update_channel read it for the query and again for the except
clause, so a silo mode switch on another thread in between let
Option.DoesNotExist escape as an error. Relay integration tests hit this
as intermittent 500s on /api/0/relays/projectconfigs/ when a live server
request ran while the test switched silo mode.

Refs DI-2898

Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

DI-2898

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 19, 2026
@joshuarli
joshuarli marked this pull request as ready for review November 19, 2026 00:45
@joshuarli
joshuarli requested a review from a team as a code owner November 19, 2026 00:45
@sentry-junior
sentry-junior Bot requested a review from joshuarli November 19, 2026 00:45

This branch has not been deployed

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

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant