Skip to content

test: investigate intermittent full-stack dispatch allocation failure #545

Description

Failure

A native Unity 6000.4.6f1 EditMode run reported a managed allocation in AllocationMatrixTests.EmitWithFullStackIsZeroAlloc, labeled EmitFullStack-Untargeted.

The run selected both Editor and Editor.Allocations assemblies through the local MCP bridge. It completed with 1,219 passes, one failure, one skip, and eight inconclusive imported-sample cases in 277.987 seconds. The sample cases are a separate local fixture limitation. The raw result and passive framework completion status are preserved in the session 266 local artifacts.

Expected behavior

The warmed bus dispatches through an allowing interceptor, priority handlers, and postprocessors without managed allocations. The zero-allocation assertion must remain meaningful and reliable.

Investigation so far

  • This test constructs a plain MessageBus and MessageHandler. It does not exercise MessagingComponent or the current owner-lifecycle fixes.
  • Idle eviction is disabled. Before the fixture fix, diagnostics inherited the caller's global target; they were not guaranteed disabled. The emit closure is built before measurement. The helper warms both the action and the measurement wrapper.
  • All 50 isolated native repetitions passed. The original 75-case allocation fixture also passed. A repeat of the combined assembly scope passed its allocation row and retained eight imported-sample inconclusives. These results do not explain or dismiss the original failure.
  • The installed host Unity Test Framework 1.6.0 constraint was inspected. It calls Recorder.FilterToCurrentThread(), matching the relevant CI 1.4.5 behavior. Ordinary background allocation is not an established explanation. The inspected source is preserved locally in .artifacts/session266/installed-framework-source.txt.
  • Current ordinary and scheduled Unity CI exclude the Allocation category. Historical benchmark artifacts have expired, so a green historical workflow is not exact test evidence.

Confirmed fixture isolation defect

Implemented in PR #551 at commit 0a7b798ff44ae009f4235004cfe34905132e7094.

A controlled native probe calls the actual fixture setup and full-stack row. Before the fix, input DiagnosticsTarget.All remains All after setup. All three canonical kinds fail with 193 GC allocation calls across 32 measured iterations. The bus and token both report diagnostics enabled. Input Off passes all three kinds. Stack traces are disabled in this experiment.

Fixture setup now selects Off and restores caller settings in teardown. The explicit diagnostic budget rows still select All inside their test bodies. The same post-fix native probe passes all six cases: both input All and input Off become Off after setup. The probe confirms restoration of all five altered globals.

Six state regression cases repeat default-Off and explicit-All checks across the three canonical kinds. They inspect setup, bus/token construction, and restoration; they do not measure dispatch. The existing allocation matrix covers dispatch. The post-fix full allocation assembly passes 291 cases with zero failures, skips, or inconclusives in 266.4863964 seconds. Run 304297c5-bccd-4da2-8b5f-831ff95ae500 has verified cleanup and restoration of the original clean scene.

The before/after records and probe are local, ignored artifacts under .artifacts/session268/allocation-inherited-diagnostics-{before.json,after.json,probe.cs}. They are not durable downloadable evidence. This experiment proves a fixture defect and a failure mechanism. The original failure did not capture diagnostics settings, so its historical cause remains unproven.

Remaining work

  1. Preserve the completed isolated results and continue capturing every outcome under the original combined scope.
  2. Repeat the original combined suite scope with diagnostics state captured to test whether order matters.
  3. Capture state and allocation call stacks at a reproduced failure; identify the responsible production, test, or framework path.
  4. Attribute and fix any remaining original failure without retries, relaxed thresholds, skipped tests, or artificial delays.
  5. Repeat focused and full-scope verification and record the evidence.

A separate source review found duplicate postprocessor registration in the full-stack scenario. Correcting that coverage gap must not be presented as a proven fix for this allocation failure.

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions