Skip to content

server_context: entrant snapshot is copied once at Initialize and never refreshed #38

Description

@thesprockee

ServerContext copies the lobby's entrants once and serves every later accessor from that copy.

  • src/runtime/server/server_context.cpp:47-50 fill m_cachedEntrants in Initialize; :78 clears it in Terminate; those are the only writers.
  • Readers: :189-193 (by index) and :203 (count) use the cached copy.

Effect: entrants that join or leave after initialization are not reflected. Needs a decision on the refresh point (per session event vs on read).


Source: f94be4168caf22fb79a3fee9e8c668b588618760:docs/audits/2026-09-26-runtime-bug-hunt.md (entrant-snapshot-never-refreshed). Re-verified against main @ 1e23615 on 2026-09-30; read the archived record with git show <sha>:<path>. Audit records are being retired in favour of issues.

Activity

  1. added a commit that references this issue on Oct 6, 2026
  2. thesprockee commented on Oct 6, 2026

    @thesprockee
    MemberAuthor

    Fixed in PR #111 (88df8f5). Opus review confirmed both claims independently via ReVault: the 0xD8 stride (confirmed from the element allocator, constructor AND destructor, not just the 3 original call sites — the last field ends exactly at 0xD8, so appending the 0x38-byte tail at +0xA0 instead of inserting it mid-struct is correct), and the live-read's thread safety for the 3 primary readers (smite, per-tick scan — confirmed on the game's own CNSLobby::Update thread). The loadout handlers' thread-safety is inference, not full proof — broadcaster-callback dispatch thread wasn't provable from static analysis alone.

    One correction to my commit message: the call restoring the lobby pointer was 26b6b3d, not 2e90317 as I'd said.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions