Skip to content

BUG-131 - Harden RC1 Completion, Delete, And Startup-Cache Lifetime Edges

Summary

Fix the concrete RC1 stabilization findings selected from the final C++ memory safety pass. The fixes cover part-file completion shutdown races, upload-read reference drains before deletion, corrupt cancelled metadata bounds, and startup cache save low-memory exits.

Findings Addressed

  • Part-file completion low-memory recovery touched CPartFile after m_FileCompleteMutex could have been released to shutdown deletion.
  • Duplicate completed part-files reopened upload reads before the duplicate discard branch drained IOCP upload-read references.
  • DeletePartFile() waited async writes but could still free through live upload-read IOCP references.
  • cancelled.met trusted its record count and could partially retain corrupt state after parse or allocation failure.
  • Startup-cache save snapshot construction happened after marking a save as running but before the guarded failure path.
  • Startup-cache save worker completion/result allocations could fail outside the path that clears m_bStartupCacheSaveRunning.

Acceptance Criteria

  • [x] Part-file completion repairs low-memory state while the completion mutex still protects object lifetime.
  • [x] Duplicate completed part-files keep upload reads disabled until the retained known-file path is confirmed.
  • [x] DeletePartFile() closes upload-read admission, dissociates file reads, and retries later instead of deleting through live references.
  • [x] cancelled.met rejects impossible record counts and clears partial state on corruption or low-memory failure.
  • [x] Startup-cache save snapshot capture and worker startup allocations are inside the guarded starter path.
  • [x] Startup-cache save worker posts a preallocated completion payload and the UI handler can clear matching running state on abnormal null-result completion.

Implementation Evidence

  • 6ed591bc BUG-131 harden part-file deletion lifetimes
  • 5c8a94b3 BUG-131 bound cancelled metadata loading
  • 92ed7377 BUG-131 guard startup cache save allocations

Validation Evidence

  • git diff --check
  • Debug and Release x64 app builds through python -m emule_workspace build app before each granular app commit.