Skip to content

libsidecar-cpp: remaining semantic differences vs the Go sidecar (cross-realm, threading, failure modes) #104

Open

Description

@3kynox

While auditing libsidecar-cpp against the Go sidecar export by export (which produced #101/#102/#103), I found a handful of differences that are design decisions rather than bugs I'd fix unilaterally. Filing them here so they're on the record; happy to implement whichever direction you pick.

Cross-realm mode (both moot for single-realm deployments, but the Go path supports them):

  1. api.cpp keeps g_state.realm_id = 0 when isCrossRealm is set, and both matchmaking notifications hard-code is_cross_realm=false — so TC9PlayerLeftBattleground/TC9BattlegroundStatusChanged send realm 0 + cross-realm=false where the Go sidecar sends the real realm ID plus the IsCrossRealm flag.
  2. GuidManager keeps one iterator per GUID type and ignores the realm argument of Next(realm_id); the Go CrossrealmMgr keeps a per-realm provider map with lazy init. On a server hosting several realms the C++ pools would get mixed across realms.

Threading of outbound calls:
3. TC9ReadyToAcceptPlayersFromMaps and the two matchmaking notifications are synchronous gRPC calls (5s/2s deadlines) on the calling thread — which is the world update thread in AzerothCore. The Go sidecar fires the maps notification in a goroutine and pushes matchmaking notifications through buffered channels drained by 4 workers. With the matchmaking service slow or down, each BG status change can stall the world thread up to 2s on the C++ path.
4. GUID pool refills spawn a detached std::thread per trigger with no in-flight guard, so a burst of GetNext*Guid calls can spawn several concurrent refills for the same type (and a detached refill can race TC9GracefulShutdown tearing down grpc_clients_).

Failure modes:
5. When registration with servers-registry fails at init, the Go sidecar calls log.Fatal (process dies — visible in k8s as a crash loop); the C++ one logs an error and returns with initialized=false, so the worldserver keeps running invisible to the cluster. Fail-fast vs fail-soft is worth an explicit choice.

Minor observations, no action needed: on a monitoring-collector timeout /metrics serves stale gauges where Go returned 504; the api field sent in RPCs is TC9_VERSION_STRING where Go sent "0.0.1" (nothing gates on it); and the Go-era Call* shims of the gRPC-request families always return NoHandler ("bridging not yet implemented") — harmless since the live path goes through the gRPC service, and #102 pins their current contract.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions