Skip to content

ChorusHubServerInfo uses static field for discovered server, causing state leakage between instances #376

Description

@imnasnainaec

ChorusHubServerInfo stores its discovered server in a static field (src/LibChorus/ChorusHub/ChorusHubServerInfo.cs):

private static ChorusHubServerInfo _chorusHubServerInfo;

All code paths that call FindServerInformation() — including SyncStartControl.CheckNetworkStatusAndUpdateUI — share this single instance. In test scenarios or when multiple independent sync sessions run in the same process, a stale server discovered by one session leaks into another. The existence of ClearServerInfoForTests() as a public workaround confirms this is a known design issue:

public static void ClearServerInfoForTests()
{
    _chorusHubServerInfo = null;
}

Fix: Convert _chorusHubServerInfo to an instance member, or restructure discovery to use a properly scoped pattern that does not share state across unrelated sessions.

Found via DeepWiki.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions