Fix interleaved subscription operations#52369
Merged
maxbrunsfeld merged 2 commits intomainfrom Mar 25, 2026
Merged
Conversation
…tterns co-authored-by: max <max@zed.dev>
7d8ea05 to
0640b7a
Compare
Collaborator
maxbrunsfeld
left a comment
There was a problem hiding this comment.
Nice! Thanks for figuring this out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Since #52232, there have been a lot of problems related to panels randomly hiding and showing themselves. However, the code in that PR is pretty innocuous. It shouldn't be having that kind of effect. However, it turns out there's a bug in how GPUI subscriptions work that caused there to be orphaned observe callbacks firing spuriously. The core sequence is captured in
test_unsubscribe_during_callback_with_insert, essentially you have to have two observers on the same item (SettingsStore, in this case), that both drop themselves. If the first observer adds a callback onto the same item, then the second observer will never successfully drop itself.While in there, I also fixed an unrelated bug that @maxbrunsfeld noticed where if you have two callbacks on the same item, and an earlier callback drops a later one, then the second callback will spuriously fire.
I also added a few extra smoke tests to the subscription code, and a test capturing the observed bug at the workspace level.
Self-Review Checklist
Release Notes: