Conversation
ListenerCoroutine was guarding its drain-and-exit path with `!running_`, but `running_` was never set anywhere in subspace::Server, so the loop would treat the server as "shut down" on the very first iteration and break out as soon as the scheduler reached a single coroutine. The intended flag is `shutting_down_`, which is set by the shutdown path and is what the discovery and gratuitous-advertise coroutines also check. While here, remove the now-unused `running_` member of subspace::Server. (server/python/server.cc has its own unrelated `running_` field on a different class; it's not affected.) Made-with: Cursor
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.
Summary
Server::ListenerCoroutinewas checking!running_to decide when to drain and exit, butsubspace::Server::running_is never assigned anywhere in the codebase. Withrunning_alwaysfalse, the listener loop took the "we're shutting down" branch on every iteration and exited as soon as the scheduler had a single coroutine left, instead of waiting for an actual shutdown.shutting_down_, which is the flag thatServer::Stop()sets and that the discovery / gratuitous-advertise coroutines already use for the same purpose.bool running_ = false;member ofsubspace::Server. (The unrelatedrunning_field inserver/python/server.ccis on a different class and is not affected.)Test plan
bazel test //server:server_testbazel test //client:client_testsubspace_server+manual_tests/{pub,sub}and confirm the server keeps accepting new client connections instead of exiting prematurely once the first client disconnects.SIGTERM/ callStop()and confirm the listener still drains correctly on actual shutdown.Made with Cursor