Repository navigation
Hold the bridge lock across catalog and live updates - #5
Open
dimondevceo wants to merge 1 commit into
Open
dimondevceo wants to merge 1 commit into
dimondevceo wants to merge 1 commit into
Conversation
dimondevceo
marked this pull request as ready for review
September 30, 2026 02:05
The sync loop reads Server.Plugins and bridgeHost.live while tests and startup assign them. Take bridgeHost.mu on both sides. Co-authored-by: DimonDev <dimondevceo@users.noreply.github.com>
cursor
Bot
force-pushed
the
cursor/fix-bridge-sync-race-d9ae
branch
from
September 30, 2026 02:11
982863d to
42e2fed
Compare
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.
Race
go test -racefails ininternal/httpapi.startBridgesstarts a goroutine that calls(*bridgeHost).syncimmediately and then every 15 seconds.syncreadsServer.PluginsandbridgeHost.live. Tests assignsrv.Pluginsandsrv.bridges.liveafternewTestServer. Startup assigns the catalog afterInit. Those writes do not takebridgeHost.mu.The race detector reports that conflict. The failing tests are
TestBridgeSettingsStayOnHost,TestPluginHTTPRoutes,TestPluginScheduleRoute, andTestScreenUsesCatalogAndKeepsCalledNumber. Assertions in those tests were not the failure. The same failure is still on main46a3152(v0.9.15).Fix
synccopiesServer.Pluginswhile holdingbridgeHost.mu.liveis written only under that lock.SetPluginspublishes the catalog under the same lock. The bridge settings test publishes the catalog andlive=falsein one critical section, so sync cannot dial a catalog that the test just paused.Bridge catalog sync is unchanged. Bridge settings still stay on the host. The v0.9.15 bridge-open and per-minute scan billing behavior is untouched. Rebase onto
46a3152had no conflicts.Check
go test -race -count=1 ./internal/httpapi/...passed on head42e2fedafter the rebase.