Skip to content

Clean-exit grace period can be preempted by a shorter discovery timeout #365

Description

@bobtista

Problem

AdoptExpectedChildProcessAsync (GameProcessManager.cs) checks the discovery deadline before the
clean-exit grace period elapses, so the two can race.

When a launcher exits cleanly without spawning a child, the loop records launcherExitedAt and
keeps polling for ProcessConstants.LauncherExitGracePeriodMs (1s) to cover the
spawn-then-enumerate window. But the deadline check runs in the same iteration. If a caller sets
GameLaunchConfiguration.ExpectedChildDiscoveryTimeout shorter than that grace period, the
deadline wins and the failure is reported as:

Launcher did not start {name} within 0.5s.

instead of the accurate:

Launcher exited without starting {name}.

Wrong diagnosis, not wrong outcome — both fail the launch. It matters because the timeout message
sends someone looking for a slow launcher when the launcher already exited.

The default timeout is SpawnedChildDiscoveryTimeoutMs (10s), well above the 1s grace, so this
only surfaces for callers passing a short explicit timeout. Tests do exactly that.

Approach

Either clamp the effective deadline so a recorded clean exit always gets its grace period, or drop
the grace period and accept the spawn-then-enumerate race. Worth confirming which failure the
message should favour when both conditions are genuinely true.

Introduced by #343, present in release/alpha-4.

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

    BugSomething isn't working rightFixIs fixing somethingMinorSeverity: minor < major < criticalWIP

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions