Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two races #4301

Merged
merged 2 commits into from
Oct 10, 2020
Merged

Fix two races #4301

merged 2 commits into from
Oct 10, 2020

Conversation

Stebalien
Copy link
Member

Lifecycle

LifecycleCtx can only be called during startup as it appends an fx hook. Worse, this was causing us to append an fx hook on every single hello message, leaking memory (and probably causing other shutdown issues...).

Sync Manager

  1. SyncerState contains a mutex and should never be copied. Honestly, this case was probably fine but it's just as easy to create a separate snapshot type and easier to reason about.

  2. We need to initialize the syncStates array once at start, before accessing it. By each syncer state inside each worker, we were racing with calls to State(). Again, this was probably benign, but I don't trust optimizing compilers.

1. SyncerState contains a mutex and should never be copied. Honestly, this case
was probably fine but it's just as easy to create a separate snapshot type and
easier to reason about.

2. We need to initialize the syncStates array once at start, before accessing
it. By each syncer state inside each worker, we were racing with calls to
`State()`. Again, this was probably benign, but I don't trust optimizing
compilers.
LifecycleCtx can _only_ be called during startup as it appends an fx hook.
Worse, this was causing us to append an fx hook on every single hello message,
leaking memory (and probably causing other shutdown issues...).
@magik6k magik6k merged commit a491fc9 into master Oct 10, 2020
@magik6k magik6k deleted the steb/fix-two-races branch October 10, 2020 18:37
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.

None yet

2 participants