You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Init mutates runner state without runnerMu, racing Stop/Destroy #23
These are concurrent gRPC handlers — the same reasoning that put runnerMu around Start/Stop in #21 applies here.
Concrete failure
Init evaluates s.runnerEnvironment == nil as false (an environment from an earlier Init).
Destroy runs, shuts the environment down and sets the field to nil.
Init reaches s.runnerEnvironment.Init(ctx) and dereferences a nil interface — a panic, caught by the deferred s.Wool.Catch() but a crash path all the same.
A narrower version wipes cacheLocation while Init is populating it, or has Init complete against an environment that was just shut down.
The fix is not local to the lines #22 touched. Doing it properly means either holding runnerMu across Init's runner-environment section — which serialises Stop/Destroy behind a potentially long docker pull — or capturing the environment in a local under the lock and threading it through Init and GenerateOpenAPI. Both are design decisions about Init, not fallout from the Destroy fix.
Suggested direction
Capture the environment once under runnerMu and use the local for the rest of Init, so a concurrent teardown cannot nil the value mid-flight, and publish cacheLocation/runnerEnvironment under the same lock. Worth checking against core#415's lifecycle contract first — a terminal state there may make part of this moot.
Verification should include a -race test running Init concurrently with Destroy; the current suite never overlaps them, which is why go test -race is green today.
Activity
fix: enforce the runner-state locking that #23 introduced (#23)
docs: point the ActiveEnv comment at the issue it tracks (#23)
fix: give Init a locking discipline for the runner state (#23)
fix: enforce the runner-state locking that #23 introduced (#23)
docs: point the ActiveEnv comment at the issue it tracks (#23)
fix: give Init a locking discipline for the runner state (#23) (#25)
test: make the Init/Start race test detect the race (#24)
fix: serialize Init against Start (#24) (#26)