Skip to content

test(memory): add deterministic OOM fault-injection coverage #33

Description

@TrixNEW

Problem

Fuzzing and soak tests do not guarantee every allocation-failure path is tested.

zphp uses manual ownership, reference counting, pools, GC, and native resources, so an OOM at the wrong point can cause leaks or partially corrupted runtime state.

Changes

Use Zig's failing allocator testing to intentionally fail the Nth allocation and verify cleanup.

Prioritize:

  • PhpArray.append/set
  • objects/properties
  • strings
  • references
  • closures
  • cycle collection
  • exceptions
  • native resources
  • VM reset/deinit
  • zphp serve worker startup

Verify after each failure

  • no leaked allocations/refcounts
  • no double-free or use-after-free
  • no partially modified arrays
  • no stale GC/tracking entries
  • no leaked sockets/file descriptors/native resources

Acceptance criteria

  • Core ownership-sensitive operations have deterministic OOM tests.
  • Failed allocations leave the runtime valid or cleanly terminated.
  • The fault-injection suite runs in CI.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions