Skip to content

Fix disconnects breaking view updates for other connections#4607

Merged
joshua-spacetime merged 2 commits intomasterfrom
joshua/fix/view-updates-after-disconnect
Mar 11, 2026
Merged

Fix disconnects breaking view updates for other connections#4607
joshua-spacetime merged 2 commits intomasterfrom
joshua/fix/view-updates-after-disconnect

Conversation

@joshua-spacetime
Copy link
Collaborator

Description of Changes

Fixes a bug in client disconnect logic that would mark a client's views as dropped(unsubscribed). However it was marking the identity's views as dropped, not the connection. So if an identity had multiple connections open, each subscribing to different views, and one of them disconnected, the subscriptions for the other connections would break. The observed behavior would be that they would stop receiving subscription updates. This could potentially lead to their client cache getting into a corrupted state.

Now, instead of dropping all of the views for a particular identity on disconnect, we drop only the views for that particular connection. And when I say drop, what I really mean is decrement. A view is not dropped completely unless it no longer had any subscribers.

API and ABI breaking changes

None

Expected complexity level and risk

2

Testing

Regression smoketest was added

@gmorenz
Copy link

gmorenz commented Mar 10, 2026

That sounds like a good find, but I don't think it explains the issue I'm seeing in #4603. I have a different identity for each connection because I'm starting them with .with_token(None::<String>). And I just confirmed that

println!("{}", player1.conn.identity());
println!("{}", _player2.conn.identity());

prints two different things.

@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Mar 11, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 11, 2026
@joshua-spacetime joshua-spacetime added this pull request to the merge queue Mar 11, 2026
Merged via the queue into master with commit 408e54f Mar 11, 2026
35 checks passed
@joshua-spacetime joshua-spacetime deleted the joshua/fix/view-updates-after-disconnect branch March 11, 2026 16:45
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.

Spacetimedb fails to update sender dependent view

3 participants