5949: An early Earth and Moon to Solar System save load can crash the texture upload worker

Maxi

Member
Messages
216
Reaction score
167
(Probably relevant for mostly @Linx . Bug found by me, analyzed, verified and bug report written by both me and gpt 6.2)

Game Version
v2026.11.25.5949, with Core content and stock craft. The two runs that crashed used StarMap 0.5.4 for an isolated profile and one diagnostic plug-in to time the stock save load. The detailed run also recorded resource lifetime events. The profiler and menu controls loaded only Core.

Operating System
Windows 10 Pro x64 (build 19045), NVIDIA GeForce RTX 5080, driver 617.14. The positive runs used 3840 x 2160 and texture streaming enabled. This was tested on one machine.

What Happened
KSA switched from Earth and Moon (SolLite) to Solar System (Sol) in the same process and applied the requested save. The upload worker then crashed with native access violation 0xC0000005. The plain diagnostic run reported StreamingUploader.RecordCopy. The lifetime trace recorded the same request entering that method without a return, followed by a fatal stack with StreamingUploader.SubmitBatch and WorkerLoop.

The outgoing Earth diffuse texture had already been destroyed when that worker entered copy recording. The trace matches the queued request to the destroyed image by allocation identity.

What Was Expected
The game switches to Sol, applies the save and continues rendering. Outstanding uploads retain valid targets until they finish or are safely cancelled.

Reproduction Steps
These steps describe the automated run that reproduced the crash.
  1. Start 5949 in Earth and Moon (SolLite), at 3840 x 2160 with texture streaming enabled. Have the stock Sol save Sol System Switch in the profile.
  2. Just after the second rendered gameplay frame, have the probe call the save's normal UncompressedSave.Load() path. The probe verifies that the save selects an in-process swap and that VRAM preflight permits it.
  3. Let the normal frame loop process the switch. In the captured failure, the requested save applied, then an upload request from the outgoing system reached copy recording and the worker crashed.
For the menu controls I pressed F7 (the default Save/Load shortcut) in SolLite, double-clicked the same Sol save and confirmed the load. All three controls switched to Sol, rendered the loaded flight and shut down normally. The earliest confirmation was about 9 seconds after the log marked initialization complete, at 3840 x 2160. The timed runs used the stock loader, renderer and uploader, with the probe setting the load timing and, in the detailed run, recording events.

Reproduction Rate
  • Two frame-2 runs with Core content, a diagnostic plug-in and streaming on crashed in the stock upload path. One used only the timed load and plain observation. The other added the allocation trace.
  • One frame-2 run at 4K with streaming off applied the same save, completed 181 rendered frames and shut down normally. The control observer detected a separate stale selected-vehicle reference in that run.
  • Two Core-only controls with streaming on used stock ProfilerCapture at gameplay frame 60. Both applied the same save and exited normally, at 1280 x 720 and 3840 x 2160. StarMap supplied the scratch profile in these controls.
  • Three Core-only controls with streaming on used the normal Save/Load menu, two at 1280 x 720 and one at 3840 x 2160 at the time of the switch. Each applied the same save in the running process and exited normally. StarMap supplied the scratch profiles. No probe was loaded.
The two crashes occurred at the early diagnostic timing. The ordinary menu tests did not reach that timing.

Additional Info
Attachments are the stock Sol save ksa-5949-sol-system-switch.zip and the trimmed trace texture-upload-after-swap-forum.txt. The save has a new display name and the same universe.xml as the tested file. Trace IDs identify the actual image allocation and request object across threads.

The separate rapid vessel-switching crash discussed on Discord was reproduced by Linx on the released build and attributed to ground clutter collider generation. The last captured native failure here follows an in-process star system swap and enters the stock texture upload worker on a destroyed image.

@Linx , could you take a look at the upload trace or pass it to whoever owns texture streaming? :)

Technical Analysis (decompiled 5949)
The trace below uses the enqueue of request 7 as time zero. Times are derived from a 10 MHz monotonic clock.
Code
Elapsed       Thread  Event
   0.000 ms   Main    enqueue request 7, image 4, Earth_DiffuseStream mip 0
 238.238 ms   Main    return from deleting image 4 during ForceFlush
8166.086 ms   Main    exact Sol save application observed
8180.076 ms   Upload  enter RecordCopy for request 7, image 4
                      native 0xC0000005, no copy return
The worker entered copy recording 7.942 s after the image delete returned. An earlier upload request (5) for the same image returned from copy recording before the switch. The probe tags each image creation with a distinct allocation ID and associates that allocation with the request at enqueue time. This avoids matching on the Vulkan handle value alone.
  • Program.SwapSystem waits for game jobs and calls Device.WaitIdle, then disposes the outgoing system's renderers. PlanetRenderer.Dispose disposes its CelestialTextureStreamer.
  • The streamer clears its reference to the in-flight promotion and retires the old images. That bookkeeping leaves outstanding requests in the shared uploader valid from the uploader's perspective. RetiredResourceQueue.ForceFlush destroys the retired images during the swap.
  • The shared StreamingUploader survives the swap. Its worker can drain requests into a local batch before recording and submitting them. Submitted work is tracked in _inFlight after submission. A device idle wait covers submitted work. The worker may still own or pick up work that has yet to be submitted.
  • The streamer's disposed check in OnPromotionCompleted runs at completion. That is too late to protect the images used to record the copy. The trace pins down the bad lifetime order, while the exact dequeue point and faulting native instruction remain unobserved.
The StreamingUploader.cs file is identical on 5901 and 5949. The in-process save-driven system switch is new in 5949.

Suggested Fix
Stop new texture requests for the outgoing system and explicitly coordinate teardown with the upload worker. Cancel work that can still be cancelled safely and either drain or retain the images for work already owned by the worker until its GPU completion fence signals. Apply the same lifetime rule to any staging resources referenced by those uploads. The quiescence check needs to cover pending, worker-local, and submitted work. The pending and in-flight counters alone can miss a batch between dequeue and publication. I have verified the lifetime ordering in the released build. An engine fix has yet to be tested.

Related Threads
 

Attachments

Upvote 1
Back
Top