Skip to content

Resolve Universal Mapping Symbols By Time - #2510

Draft
Brian Robbins (brianrob) wants to merge 18 commits into
microsoft:mainfrom
brianrob:brianrob/time-scoped-traceevent-symbols
Draft

Brian Robbins (brianrob) wants to merge 18 commits into
microsoft:mainfrom
brianrob:brianrob/time-scoped-traceevent-symbols

Conversation

@brianrob

@brianrob Brian Robbins (brianrob) commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: b686696893108e47b5b8f1bfe9c011420a257dea

Dimension Assessment Rationale
Change confidence 8/10 ↑ 59 targeted lifecycle and live-state tests, event-6 fixture, and five live-capture comparisons passed.
↓ Full WSL suite has 133 baseline failures; overlapping CLR and Universal attribution remains unsupported.
Diagnosis confidence 9/10 ↑ Unresolved address attribution ignored mapping lifetimes, and the fixture reproduced the original issue.
Evidence fit 9/10 ↑ Address reuse, unload, and gap symptoms match the fixture and One-Collect capture comparisons.
↓ The fixture is synthetic.

Universal mappings can reuse an address within a process, causing TraceLog to attribute samples to the first symbol at that address rather than the mapping active at sample time. This change tracks mapping generations and resolves symbols against their lifetimes.

Adds Universal.System event 6 for explicit mapping unloads. Partial unloads preserve the remaining ranges; unloading an overlay reveals the prior live mapping. State and symbols are scoped to a process instance and mapping ID, and process exit ends its mappings. At equal timestamps, mapping changes apply to samples; exit follows them.

Older readers that ignore event 6 can retain stale symbols. Symbols are not borrowed from another process instance even when mapping IDs match.

Validation

  • WSL Debug: 59 targeted mapping and live-state tests passed; the net462 test project built. Full TraceEvent suite: 2,765 passed, 133 failed, 28 skipped; failure names matched the WSL baseline.
  • Event-6 fixture: 21/21 TraceLog samples correct. Five live capture scenarios had no wrong, unknown, or missing results.

Mapping bookkeeping benchmark

BenchmarkDotNet 0.15.8, Ubuntu 22.04 WSL, .NET 10.0.13, Release; one launch, one warmup, three measured iterations. Each operation loads and unloads the indicated mappings, then enumerates the module collection. Values are means; these synthetic workloads are not production conversion times.

Workload Before After Allocated before → after
20,000 cycles, one address 4.646 s 39.20 ms 13.98 → 14.82 MB
20,000 cycles, 4,096 addresses 3.691 s 47.86 ms 14.51 → 15.9 MB
50,000 cycles, 10,000 addresses 33.267 s 135.95 ms 34.62 → 37.63 MB

The improvement defers sorting Universal module records until legacy lookup, enumeration, or serialization, and caches Universal module files by name, address, and metadata identity. Varied-address results include both improvements; the same-address workload avoids the prior name-chain scaling cost. Repeated intervening legacy lookups can still force repeated materialization. The benchmark has only three measured iterations, and BenchmarkDotNet warned that the first two optimized iterations were shorter than its recommended minimum.

Relates to microsoft/one-collect#339

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 3f8d6872a4e3.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 3f8d6872a4e36cbfea2a44cfa7ce3044c12ca729

Areas Reviewed

  • Universal provider format, parser, and compatibility contract
  • Mapping lifetimes, overlays, address reuse, and process isolation
  • Timestamp-scoped stack identity in offline and live conversion
  • Symbol/module attribution and ETLX persistence
  • Architecture: public lifecycle and symbol ownership change; external dependencies are unchanged.

Areas Requiring Human Review

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior. - An older trace that emits a shared mapping's symbol once can lose method names in other processes. src/TraceEvent/EventPipe/UniversalProviders.md:39 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:63 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:115-116 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:159-165 (RIGHT)

    Explanation

    Previously, if two processes shared a mapping ID, one symbol event could name samples in both. The new reader only names samples in the event's process, so the other process needs its own symbol event.

    Origin: Partly existing behavior that this PR changes. The existing shared-ID fan-out is replaced with process-instance isolation without changing the existing mapping or symbol event IDs.

    Decision needed: Accept this compatibility change for older traces and producers, or require a versioned way to preserve their shared-symbol behavior.

    Evidence: The previous converter applied each symbol to every process associated with its trace-wide mapping ID. The new converter captures the symbol event's process and resolves only that process's generation; the documentation now requires per-process emission. src/TraceEvent/EventPipe/UniversalProviders.md:39 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:63 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:115-116 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:159-165 (RIGHT)

  • [HR-2] Confirm overlay restoration and explicit replacement semantics. - The new provider contract makes unloading an overlay reveal the earlier live mapping. src/TraceEvent/EventPipe/UniversalProviders.md:46-52 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:68-72 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:88-107 (RIGHT)

    Explanation

    A later mapping overlays an earlier one without unloading it; unloading the overlay makes the earlier live mapping visible again. Permanent replacement requires an explicit unload of the earlier mapping.

    Origin: Introduced by this PR. The PR adds a mapping-unload event and process-scoped live-range tracking that implement this lifecycle policy.

    Decision needed: Accept restoration of an underlying live mapping on overlay unload, or require a different replacement policy.

    Evidence: The new provider documentation defines partial unloads, overlay restoration, explicit replacement and equal-time ordering; the converter retains earlier live generations and removes only the named mapping's intersecting ranges. src/TraceEvent/EventPipe/UniversalProviders.md:46-52 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:68-72 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:88-107 (RIGHT)

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard. - Readers that ignore the new unload event may silently attribute samples to unloaded code. src/TraceEvent/EventPipe/UniversalProviders.md:74 (RIGHT), src/TraceEvent/Parsers/UniversalSystemTraceEventParser.cs:100-108 (RIGHT), src/TraceEvent/TraceEvent.Tests/Universal/TimeScopedMappingTests.cs:122-130 (RIGHT)

    Explanation

    A reader unaware of ProcessMappingUnload can parse the trace while keeping old symbols after an unload. There is no lifecycle-completeness signal telling that reader its attribution may be stale.

    Origin: Introduced by this PR. The PR introduces event ID 6 and documents parse-compatible but potentially incorrect results in readers that do not implement it.

    Decision needed: Accept silent degradation in older readers, or require a minimum-reader capability or compatible producer fallback before enabling unload-bearing traces.

    Evidence: The provider contract explicitly permits stale symbols in readers that ignore stable event ID 6 and provides no lifecycle-completeness signal or tombstone mode. The compatibility fixture demonstrates retained symbols when unloads are omitted. src/TraceEvent/EventPipe/UniversalProviders.md:74 (RIGHT), src/TraceEvent/Parsers/UniversalSystemTraceEventParser.cs:100-108 (RIGHT), src/TraceEvent/TraceEvent.Tests/Universal/TimeScopedMappingTests.cs:122-130 (RIGHT)

Code Review Feedback


Written by Robert Bobby (Brianrob's Code Review Bot).

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 4b70b9bc691b.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 4b70b9bc691b56f8890b1d0ae035f477eef727c4

Since last review (3f8d6872a4e3 -> 4b70b9bc691b): 4 fixed, 5 still open, 3 new findings, 1 new simplification.

Areas Reviewed

  • Universal provider payload, lifecycle ordering and compatibility contract.
  • Process-local mapping generations, deferred symbols and mixed-source attribution.
  • Timestamp-scoped stacks, event address references and live-session trimming.
  • Persisted ETLX module lifetimes and public lookups; material ownership/compatibility change, no external dependency changes.

Areas Requiring Human Review

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers. - Since the prior summary, mapping lifetimes have become persisted TraceLoadedModules state rather than converter-only state. Public lookups now depend on an optional segmented timeline, while earlier readers accepting ETLX version 78 can skip it and retain single-range lookup semantics. src/TraceEvent/TraceLog.cs:6927-6939 (RIGHT), src/TraceEvent/TraceLog.cs:7517-7520 (RIGHT), src/TraceEvent/TraceLog.cs:7675-7701 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:74 (RIGHT)

    Explanation

    ETLX now stores address-and-time segments for each Universal mapping. Address lookup selects the latest live mapping at that address; filename lookup returns a mapping while any piece remains live. Existing module records still summarize the original image and final unload time. An earlier version-78 reader can open the file but skip the segments, so it can return an overlay for a partially unloaded address where the new reader correctly restores the underlying mapping.

    Origin: Introduced by this PR. The changes since the prior summary add the persisted timeline and redirect public lookups to it without increasing the outer ETLX version or requiring a timeline-aware reader. This is distinct from HR-3: degradation can occur when reading an ETLX already converted with full unload support, not merely when ignoring raw event 6.

    Decision needed: Accept this segmented public-lookup and additive-storage contract, including degraded lookup in earlier compatible ETLX readers, or require a reader-version safeguard for timeline-bearing files.

    Evidence: Current TraceLog.cs:6927-6939 and 6953-6971 make the timeline authoritative for Universal lookups. Lines 7595-7635 preserve partial-unload history while updating scalar unload times only when no live piece remains. Lines 7517-7520 permit older readers, and 7675-7766 append and read tagged timeline data. The outer ETLX version remains 78 at 4209-4221. FastSerialization.cs:2012-2014 and 2059-2129 skip unconsumed tagged suffixes. Comparing both complete PR diffs against their shared merge-base confirms this persistence extension was absent from the prior reviewed change. src/TraceEvent/TraceLog.cs:6927-6939 (RIGHT), src/TraceEvent/TraceLog.cs:7517-7520 (RIGHT), src/TraceEvent/TraceLog.cs:7675-7701 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:74 (RIGHT)

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    Previously, when two processes shared a mapping ID, one symbol event could name samples in both. The current converter applies that symbol only to the event's process instance. Another process using the same mapping ID needs its own symbol event or its samples remain without that method name.

    Origin: Partly existing behavior that this PR changes. The PR replaces existing shared-ID symbol fan-out with process-instance isolation while retaining the existing mapping and symbol event IDs. The current push preserves that decision.

    Decision needed: Accept the compatibility change for older traces and producers, or require a versioned mechanism preserving their shared-symbol behavior.

    Evidence: Current UniversalProviders.md:39 and 63 still require process-instance-local mapping references and separate symbol emission per process. NettraceUniversalConverter.cs:123-124 captures the symbol event's TraceProcess; 167-173 resolves only that process's mapping generation. Independently read merge-base source instead associates a mapping ID with all participating processes and fans each symbol out to that set. The full-PR comparison shows the current push retains the process-local policy. src/TraceEvent/EventPipe/UniversalProviders.md:63 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:167-173 (RIGHT)

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    Loading B over A does not unload A. Unloading all or part of B reveals A wherever A remains live. To make B a permanent replacement, the producer must explicitly unload A first; a filename such as vmlinux is not an unload command.

    Origin: Introduced by this PR. The PR introduces this overlay lifecycle through event 6 and per-process live ranges. The current push additionally preserves it in ETLX and public module queries.

    Decision needed: Accept restoration of still-live underlying mappings and the requirement for explicit permanent replacement, or choose a different provider lifecycle policy.

    Evidence: Current UniversalProviders.md:48-52 and 70 explicitly retain partial unload, underlying-overlay restoration, and explicit permanent replacement. NettraceUniversalConverter.cs:74-77 retains earlier generations; 98-115 unloads only the named generation; 336-345 chooses the newest generation still containing an address. TraceLog.cs:6930-6934 and 7595-7623 now persist the same policy. No current change removes the underlying lifecycle decision. src/TraceEvent/EventPipe/UniversalProviders.md:70-72 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:103-115 (RIGHT)

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    A reader that ignores ProcessMappingUnload can continue parsing while retaining names for code that has been unloaded. For example, after B is unloaded, that reader can still name a later sample B instead of observing the remaining mapping or gap.

    Origin: Introduced by this PR. The PR adds event 6 without a lifecycle-completeness signal or compatibility fallback. The current push leaves that provider policy unchanged.

    Decision needed: Accept silent attribution degradation in event-6-unaware readers, or require a minimum-reader capability or compatible producer fallback before using unload-bearing traces.

    Evidence: Current UniversalProviders.md:76 still explicitly permits stale symbols in readers unaware of event 6 and states that no completeness signal or tombstone mode exists. UniversalSystemTraceEventParser.cs:100-108 and 128 retain stable event ID 6. TimeScopedMappingTests.cs:121-133 supplies a fixture omitting unloads and expects stale B/replacement symbols. The current push fixes registration removal and adds ETLX persistence, neither of which changes this raw-provider compatibility decision. src/TraceEvent/EventPipe/UniversalProviders.md:76 (RIGHT), src/TraceEvent/TraceEvent.Tests/Universal/TimeScopedMappingTests.cs:121-133 (RIGHT)

Code Review Feedback

Earlier findings still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 4bf3818f3030.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 4bf3818f3030898ebb69d03fa74d7e19084b1588

Since last review (4b70b9bc691b -> 4bf3818f3030): 6 fixed, 8 still open, 9 new findings (7 in previously reviewed code), 2 new simplifications.

Areas Reviewed

  • Universal provider payload, event ordering, and producer compatibility.
  • Mapping lifetimes, mixed-source attribution, and deferred symbol ownership.
  • Equal-time event and stack references, including live-session synchronization.
  • Public module queries and ETLX persistence: material contract change; no external dependency changes.

Areas Requiring Human Review

  • [HR-5] Decide whether overlapping CLR and Universal symbol sources are supported. - The iteration preserves native fallback outside Universal mapping ranges and publicly disclaims correct CLR attribution when the two sources overlap. It does not define a precedence rule for the overlap. src/TraceEvent/EventPipe/UniversalProviders.md:79 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:167-173 (RIGHT), src/TraceEvent/TraceLog.cs:9009-9021 (RIGHT)

    Explanation

    A Universal transition can remove a sampled address from the table a later CLR method event searches. The CLR event can then miss that sample even though it describes the same address. Conversely, an address already claimed by CLR is not available for Universal detachment.

    Origin: Partly existing behavior that this PR changes. The prior push already separated Universal generations without reconciling overlapping CLR lifetimes. This push restricts final cleanup so unrelated native addresses remain available and explicitly documents that overlapping CLR attribution is not guaranteed.

    Decision needed: Accept the documented limit for mixed traces, or define and test how CLR and Universal attribution interact within overlapping ranges.

    Evidence: NettraceUniversalConverter.cs:145–173 narrows the prior process-wide cleanup to the original Universal mapping extents. At transitions, lines 266–280 remove matching unresolved address entries and assign them to a generation. The separate CLR resolver still consumes the shared unresolved table (TraceLog.cs:2476–2487, 9009–9021). UniversalProviders.md:79 adds the overlap caveat. src/TraceEvent/EventPipe/UniversalProviders.md:79 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:167-173 (RIGHT), src/TraceEvent/TraceLog.cs:9009-9021 (RIGHT)

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    Two process instances can use the same mapping ID without inheriting each other's names. A legacy producer that emits one symbol for a shared ID no longer names samples in the other processes.

    Origin: Partly existing behavior that this PR changes. The PR replaces trace-wide symbol fan-out with process-instance lookup and tells producers to emit symbols separately.

    Decision needed: Require per-process symbol emission, or provide an explicit compatibility path for producers that emitted shared symbols.

    Evidence: The merge-base converter fans one symbol out to all processes registered for the ID (NettraceUniversalConverter.cs:94–105). The current converter uses only the symbol event's process instance and its mapping ID (lines 130–133, 181–190). microsoft/one-collect@b014131:one_collect/src/helpers/exporting/formats/nettrace.rs:537–563, 852–939 writes symbols in each mapping replay's process context; it does not establish that other producers do the same.

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    If mapping B covers part of mapping A, unloading part of B exposes the corresponding part of A if it is still live. The unaffected portions of B remain visible. A filename such as vmlinux is treated as an ordinary mapping.

    Origin: Introduced by this PR. The PR defines overlays as non-destructive and requires an explicit unload for permanent replacement.

    Decision needed: Confirm that removing an overlay should reveal the previous live mapping and that producers must explicitly unload a permanently replaced mapping.

    Evidence: UniversalProviders.md:46–52, 68–72 and NettraceUniversalConverter.cs:101–123, 350–372, 398–411 preserve earlier live ranges and remove only the named mapping's intersection.

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    Older raw readers can continue parsing a trace without noticing an unload, then keep attributing samples to a mapping that has ended.

    Origin: Introduced by this PR. The PR consumes and documents event 6 but adds no completeness signal or compatibility mode for older readers.

    Decision needed: Accept silent stale attribution in older readers, or coordinate producer rollout with a capability signal, compatibility encoding, or minimum-reader policy.

    Evidence: UniversalSystemTraceEventParser.cs:97–127 adds stable event 6; UniversalProviders.md:77 states the compatibility limit, and TimeScopedMappingTests.cs:130–134 shows the expected stale names when unload events are omitted. microsoft/one-collect@b014131:one_collect/src/helpers/exporting/formats/nettrace.rs:912–939, 1195–1275 replays and registers the older event set without event 6. That snapshot is not the separately referenced producer PR #339 and cannot verify its emission or rollout.

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers - carried from an earlier review; still open.

    Explanation

    A prior reader can open a newly generated ETLX while skipping the timeline, so address lookups can report a module in a partially unloaded gap or miss a revealed overlay. An existing cached ETLX can likewise lack the new timeline even when opened by a new reader.

    Origin: Partly existing behavior that this PR changes. The PR appends optional lifetime data but keeps the file version and cache reuse policy unchanged.

    Decision needed: Accept best-effort lookups across versions and document cache regeneration, or enforce compatibility through versioning or another explicit invalidation mechanism.

    Evidence: TraceLog.cs:4230–4243 retains ETLX version 78; lines 7562–7565, 7720–7809 add optional tagged timeline data. FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 also reuses an existing cache based on file timestamps, so upgrading does not by itself regenerate an older ETLX. The current push documents the old-reader behavior at UniversalProviders.md:74–75 without changing versioning.

Code Review Feedback

Earlier findings still open:

  • Preserve deferred CLR symbols on process exit - still open at src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:59-61 (RIGHT). CLR and JScript methods still miss samples detached inside live Universal ranges before deferred resolution. The new documentation disclaims CLR overlap; it does not restore attribution.
  • Track equal-timestamp stacks for non-EventPipe conversions - still open at src/TraceEvent/TraceLog.cs:3153 (RIGHT). Completed non-EventPipe stacks are now tracked, but a user fragment waiting for kernel frames is not rebound when a mapping changes at the same tick.
  • Preserve unrelated native addresses for final module resolution - still open at src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:169-173 (RIGHT). Native addresses outside former Universal ranges are fixed. An address inside a former range is still dropped before final native fallback, even if a different native image owns it now.

Earlier simplifications still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 5a5691b8395c.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 5a5691b8395c2d363f3d99e7de9e18e756a12739

Since last review (4bf3818f3030 -> 5a5691b8395c): 15 fixed, 11 still open, 14 new findings (2 in previously reviewed code).

Areas Reviewed

  • Wire format and producer interoperability
  • Runtime mapping transitions and ownership
  • Address and stack attribution integration
  • Module queries and persisted lifetimes
  • Tests, fixtures and performance measurement
  • The PR changes mapping ownership and stack attribution from trace-wide symbol fan-out to process-instance generations, adds an unload wire event, and persists segmented module lifetimes in ETLX. The producer contract requires coordination, but no package, project, native, or toolchain dependency was added or upgraded; FastSerialization and BenchmarkDotNet were already referenced.

Areas Requiring Human Review

  • [HR-5] Decide whether overlapping CLR and Universal symbol sources are supported. - carried from an earlier review; still open.

    Explanation

    A Universal transition can detach a sample before deferred CLR resolution sees it; CLR can also claim an unresolved address before final Universal capture.

    Origin: Partly existing behavior that this PR changes. The PR preserves fallback outside Universal mapping ranges but does not define precedence where CLR and Universal sources overlap.

    Decision needed: Accept the documented mixed-trace limitation, or define and test how overlapping addresses are attributed.

    Evidence: NettraceUniversalConverter.cs:375–388 detaches affected unresolved addresses at mapping transitions, and lines 153–247 preserve unrelated addresses at final capture. TraceLog.cs:2479–2490, 9117–9129 still resolves deferred CLR methods from the shared unresolved table. UniversalProviders.md:79 disclaims correct overlap attribution.

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    A producer that emits one symbol for a mapping ID shared by several processes no longer names samples in the other processes.

    Origin: Partly existing behavior that this PR changes. The PR replaces trace-wide fan-out with process-local symbol ownership and documents separate symbol emission.

    Decision needed: Require per-process symbol emission, or preserve legacy shared-symbol behavior through an explicit compatibility path.

    Evidence: The merge-base NettraceUniversalConverter.cs:94–105 fans one symbol out to all processes registered for the ID. At head, lines 138–142 and 250–260 resolve it only in the emitting process instance. The pinned OneCollect writer emits symbols inside each process's mapping replay (nettrace.rs:681–697, 940–949); that does not establish compatibility with other producers.

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    Unloading an overlay reveals the older mapping where it remains live, while the unaffected portions of the overlay stay visible.

    Origin: Introduced by this PR. Loads no longer imply permanent replacement, and filenames such as vmlinux do not trigger special unload behavior.

    Decision needed: Confirm overlay restoration and require producers to explicitly unload any mapping they intend to replace permanently.

    Evidence: UniversalProviders.md:46–53, 68–72 and NettraceUniversalConverter.cs:108–131, 385–388, 457–475 preserve earlier live ranges. Pinned OneCollect process.rs:720–735, 1270–1295 agrees with partial-unload and overlay-restoration semantics.

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    Older raw readers can continue parsing without applying unloads, silently retaining obsolete attribution.

    Origin: Introduced by this PR. Event 6 carries unloads without a reader capability flag or compatibility encoding.

    Decision needed: Accept best-effort attribution in older readers, or require a minimum reader, capability signal, or compatible producer encoding before rollout.

    Evidence: Pinned OneCollect nettrace.rs:875–891, 1253–1263 writes stable event 6. UniversalSystemTraceEventParser.cs:97–127 consumes it; UniversalProviders.md:77 documents the absence of a completeness signal, and TimeScopedMappingTests.cs:241–245 demonstrates stale attribution when unloads are omitted.

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers - carried from an earlier review; still open.

    Explanation

    An earlier version-78 reader can open a new ETLX without honoring segmented lifetimes. A new reader can also reuse an older cached ETLX that lacks the timeline.

    Origin: Partly existing behavior that this PR changes. The PR appends optional lifetime data and documents regeneration without changing the outer version or invalidating caches.

    Decision needed: Accept best-effort cross-version module lookups and manual regeneration, or enforce compatibility through versioning or explicit cache invalidation.

    Evidence: TraceLog.cs:4233–4245 retains ETLX version 78; lines 7631–7634 and 7813–7917 make the timeline optional and tagged. FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 still reuses cached ETLX by timestamp, and UniversalProviders.md:75 now calls for regeneration.

Code Review Feedback

See the 14 inline review comments.


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit e5cbbf95f314.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: e5cbbf95f31485b2545a172cb63fa0ca1792fb66

Since last review (5a5691b8395c -> e5cbbf95f314): 27 fixed, 13 still open, 9 new findings.

Areas Reviewed

  • Universal.System event contract and producer replay ordering
  • Process-instance mapping transitions and deferred symbol ownership
  • Live and offline stack and event-address attribution
  • Module lookup, identity and ETLX persistence
  • Regression fixtures and benchmark coverage
  • The mapping timeline changes who owns each sampled address and what readers persist and query; no external dependency changed.

Areas Requiring Human Review

  • [HR-5] Decide whether overlapping CLR and Universal symbol sources are supported. - carried from an earlier review; still open.

    Explanation

    When CLR and Universal events describe the same address, the symbol source that gets it can depend on whether a mapping transition detached the address before final resolution.

    Origin: Partly existing behavior that this PR changes. Preserves fallback for unrelated addresses, but time-scoped detachment does not establish precedence for overlapping CLR and Universal sources.

    Decision needed: Accept the documented mixed-trace limitation, or define and test which source takes precedence at overlapping addresses.

    Evidence: NettraceUniversalConverter.cs:372–385 detaches unresolved code addresses during transitions; TraceLog.cs:2479–2490 applies deferred CLR/JS methods before the converter's final capture. Therefore an address detached at a transition can be unavailable to deferred CLR resolution, while one still unresolved at the end can be claimed by CLR first. The docs still disclaim correct attribution for overlap. src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:372-385 (RIGHT), src/TraceEvent/TraceLog.cs:2479-2490 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:79 (RIGHT)

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    If two processes share a mapping ID and the producer emits symbols only for one, samples in the other no longer receive those symbol names.

    Origin: Partly existing behavior that this PR changes. Replaces trace-wide fan-out with process-instance resolution and documents a separate symbol emission for every process using the ID.

    Decision needed: Require producers to repeat symbols per process instance, or preserve legacy shared-symbol fan-out through an explicit compatibility path.

    Evidence: Merge-base NettraceUniversalConverter.cs:94–105 fans one symbol out to all processes registered to the mapping ID. Head lines 134–137 and 249–255 bind it to the emitting process and its generation. R1 microsoft/one-collect@e6e4899:one_collect/src/helpers/exporting/formats/nettrace.rs:681–697,895–949 emits each mapping's symbols in that process's replay context; this does not establish compatibility with other producers. src/TraceEvent/EventPipe/UniversalProviders.md:63 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:249-255 (RIGHT)

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    If mapping B covers part of mapping A, a partial unload of B reveals A in the affected part where A remains live, without hiding B's surviving pieces.

    Origin: Introduced by this PR. Makes explicit unload, rather than a replacement load or a filename convention, end a mapping's ownership.

    Decision needed: Accept overlay restoration and require producers to explicitly unload any mapping they intend to replace permanently.

    Evidence: Head unload handling subtracts the named generation's intersecting ranges and updates its persisted lifetime; other generations remain eligible. R1 microsoft/one-collect@e6e4899:one_collect/src/helpers/exporting/process.rs:735–748,1298–1322 excludes only the unloaded address/time interval and covers restoration of the underlying mapping. src/TraceEvent/EventPipe/UniversalProviders.md:68-72 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:108-127 (RIGHT)

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    A raw trace reader that ignores event 6 can keep parsing while retaining obsolete mapping and symbol attribution after unload.

    Origin: Introduced by this PR. Adds an unload event with no way for older readers to detect that attribution is incomplete.

    Decision needed: Accept best-effort attribution in older readers, or require a minimum reader, capability signal, or compatible producer encoding before rollout.

    Evidence: R1 microsoft/one-collect@e6e4899:one_collect/src/helpers/exporting/formats/nettrace.rs:875–891,1253–1263 writes stable event 6 with three varints. Head registers the event without a completeness signal or compatibility encoding. The fixture at TimeScopedMappingTests.cs:374–379 confirms the expected stale names when unloads are omitted; it is not a historical-reader run. src/TraceEvent/Parsers/UniversalSystemTraceEventParser.cs:97-127 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:77 (RIGHT)

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers - carried from an earlier review; still open.

    Explanation

    An earlier version-78 reader can open a newer ETLX but cannot apply segmented lifetimes. A new reader can reuse an older cache whose module lookups lack those lifetimes.

    Origin: Partly existing behavior that this PR changes. Adds an optional timeline without invalidating existing caches and documents regeneration from the original trace.

    Decision needed: Accept best-effort cross-version lookup and manual regeneration, or enforce compatibility through versioning or explicit cache invalidation.

    Evidence: TraceLog.cs:4233–4245 retains outer ETLX version 78; lines 7654–7657 and 7850–7893 add optional tagged data without a higher minimum reader version. FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 still reuses an EventPipe ETLX cache by timestamp, not by whether the timeline exists. src/TraceEvent/TraceLog.cs:7850-7866 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:74-75 (RIGHT)

Code Review Feedback

See the 9 inline review comments.

Earlier findings still open:

Earlier simplifications still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 958e31382df6.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 958e31382df6bb30bc267cd6dbe150b8f4521257

Since last review (e5cbbf95f314 -> 958e31382df6): 35 fixed, 14 still open, 8 new findings, 1 new simplification.

Areas Reviewed

  • Universal event encoding, reader ordering, process-instance ownership, and synthetic trace coverage.
  • Deferred symbol capture, historical native fallback, and ETW stack and event-address rebinding.
  • Live and historical module lookup, module identity, and ETLX persistence. The wire, ownership and serialized lookup changes are architectural; no external dependency changed.

Areas Requiring Human Review

  • [HR-6] Accept the new equal-time NetTrace encoding requirement, or normalize lifecycle ordering in the reader - The current revision explicitly requires producer dependencies to hold in dispatch order, not merely file order. Mixed sorted and buffered records can otherwise cause a validly encoded unload to be dropped as unknown. src/TraceEvent/EventPipe/UniversalProviders.md:72-74 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:104-113 (RIGHT)

    Explanation

    A sorted unload can reach TraceLog before an earlier buffered load at the same timestamp. The reader drops the unload and the range remains mapped.

    Origin: Partly existing behavior that this PR changes. NetTrace buffering already allowed this ordering. The PR adds lifecycle dependencies, and this revision explicitly puts responsibility for preserving them on the producer.

    Decision needed: Require producers to preserve dispatch order using sorted records or distinct timestamps, or make the reader preserve those dependencies for mixed encodings.

    Evidence: The prior provider patch specified equal-time event order; the current revision adds the dispatch-order requirement at UniversalProviders.md:74. The unchanged EventCache.cs:68–80,175–190 dispatches sorted records ahead of buffered equal-time records; NettraceUniversalConverter.cs:104–113 discards an unload whose generation is not registered. R1 microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/formats/nettrace.rs:546–562 sets flag 64, which EventPipeEventSource.cs:1201,1355 reads as sorted; R1 one_collect/src/helpers/exporting/process.rs:490–550,931–948 establishes per-process replay stages. src/TraceEvent/EventPipe/UniversalProviders.md:72-74 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:104-113 (RIGHT)

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    If two processes share a mapping ID and only one emits symbols, the other no longer receives those names.

    Origin: Partly existing behavior that this PR changes. Replaces trace-wide fan-out with process-instance resolution.

    Decision needed: Require per-process symbol emission or preserve legacy fan-out through an explicit compatibility path.

    Evidence: Base NettraceUniversalConverter.cs:94–105 fans symbols out by mapping ID. Head lines 134–137,233–241 bind each symbol to its emitting process instance; UniversalProviders.md:60–65 requires separate emissions. R1 microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/formats/nettrace.rs:681–697,895–949 emits mapping symbols in the replay process context.

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    Unloading part of an overlay reveals the older live mapping in that part while leaving the rest of the overlay intact.

    Origin: Introduced by this PR. Adds explicit generation-scoped unloads rather than treating an overlay load as permanent replacement.

    Decision needed: Accept overlay restoration and require producers to explicitly unload mappings they intend to replace permanently.

    Evidence: UniversalProviders.md:68–72 defines overlay restoration and explicit replacement. NettraceUniversalConverter.cs:104–127 removes only the named generation's intersecting ranges. R1 microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/process.rs:735–748 applies unload filtering by mapping ID, range, and time.

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    A reader that ignores the new unload event can continue parsing and still report a symbol after its mapping has ended.

    Origin: Introduced by this PR. Adds the unload event without a lifecycle completeness signal or compatibility encoding.

    Decision needed: Accept best-effort attribution in old readers, or require a minimum reader, capability signal, or compatible encoding.

    Evidence: Base UniversalSystemTraceEventParser.cs:106–112 has no ID 6 template; head lines 100–108,124–128,145–152 add it. UniversalProviders.md:79 explicitly permits stale attribution in older readers without a completeness signal. R1 microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/formats/nettrace.rs:875–891,1253–1263 writes ID 6 with three varints. TimeScopedMappingTests.cs:443–447 omits unloads; it does not exercise an old reader.

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers - carried from an earlier review; still open.

    Explanation

    An earlier version-78 reader can open the file but cannot use segmented lifetimes. A new reader can reuse an older cache with no timeline.

    Origin: Partly existing behavior that this PR changes. Adds lifetime data without raising the reader floor or invalidating existing caches.

    Decision needed: Accept best-effort cross-version lookup and manual regeneration, or enforce compatibility via versioning or cache invalidation.

    Evidence: TraceLog.cs:4234–4246 retains outer version 78; lines 7658–7661,7853–7869,7892–7897 make the timeline optional and tagged. Unchanged FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 still reuses EventPipe ETLX caches by timestamp. UniversalProviders.md:76–77 documents regeneration.

  • [HR-5] Decide whether overlapping CLR and Universal symbol sources are supported. - carried from an earlier review; still open.

    Explanation

    When both sources describe the same address, deferred CLR resolution can claim a still-unresolved index, while an index already detached at a transition is available to the Universal generation instead.

    Origin: Partly existing behavior that this PR changes. Adds time-scoped detachment without defining precedence between CLR and Universal symbols.

    Decision needed: Accept the documented mixed-trace limitation or define and test which source takes precedence.

    Evidence: NettraceUniversalConverter.cs:382–400 detaches sampled addresses to a Universal generation at transitions. TraceLog.cs:2479–2490 applies deferred CLR methods before the converter captures remaining addresses. UniversalProviders.md:81 still disclaims correct overlap attribution.

Code Review Feedback

See 9 new inline comments.

Earlier findings still open:

Earlier simplifications still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 88ef835fef7e.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 88ef835fef7e8256d9a5430e75dc68c0f076297f

Since last review (958e31382df6 -> 88ef835fef7e): 44 fixed, 15 still open, 7 new findings (1 in previously reviewed code), 2 new simplifications.

Areas Reviewed

  • Universal wire format and producer dispatch ordering; process-instance mapping lifetimes, symbol attribution, and module identity are material architectural changes, with no external dependency changes.
  • Native and CLR integration, live and historical module lookup, ETLX persistence, and equal-time stack and event attribution.
  • Synthetic and live trace fixtures and the Universal mapping benchmark.

Areas Requiring Human Review

  • [HR-7] Define the supported attribution policy for mixed native image and Universal mapping records - The current push makes native image loads part of Universal address attribution and makes native and Universal module records distinct even when their path and base match. This is separate from the carried CLR method precedence decision. src/TraceEvent/TraceLog.cs:1607-1614 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:345-351 (RIGHT), src/TraceEvent/TraceLog.cs:11252-11267 (RIGHT)

    Explanation

    A later native image load overlapping Universal mapping history does not retroactively label an earlier unmapped sample. Address attribution uses a live Universal owner first and otherwise can fall back to an already-loaded native image. A native image and a Universal mapping at the same path and base no longer share mutable module-file metadata.

    Origin: Partly existing behavior that this PR changes. The current push adds a native-load transition before legacy registration and isolates the two module-file identity paths.

    Decision needed: Accept and document Universal-first address attribution, native fallback, and separate module identity for mixed traces, or explicitly limit the mixed-source guarantee.

    Evidence: At the prior head, TraceLog.cs:1603 sent native image events directly to ImageLoadOrUnload. The current head splits prior address ownership before registering a native load when the image overlaps Universal history, and retains an already-loaded legacy module for detached addresses with no Universal owner (NettraceUniversalConverter.cs:338–352,453–474). Native image lookup excludes Universal module records (TraceLog.cs:7137), and Universal files are excluded from the legacy name/base index (TraceLog.cs:11252–11267). src/TraceEvent/TraceLog.cs:1607-1614 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:345-351 (RIGHT), src/TraceEvent/TraceLog.cs:11252-11267 (RIGHT)

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    If only one of two processes sharing a mapping ID emits the symbol, only that process now gets the name. The pinned producer emits symbols with each replayed mapping.

    Origin: Partly existing behavior that this PR changes. Replaces trace-wide fan-out with process-instance resolution.

    Decision needed: Require per-process symbol emission, or provide an explicit compatibility path for producers that emit a shared symbol only once.

    Evidence: The base converter at NettraceUniversalConverter.cs:94–105 fans out by mapping ID. Current lines 145–148 and 242–252 bind the symbol to its emitting TraceProcess and generation; UniversalProviders.md:63 requires emission per process. microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/formats/nettrace.rs lines 681–697,894–920,940–949 emit mapping symbols in the replay process context.

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    Unloading the middle of an overlay reveals the older live mapping there without removing either surviving end of the overlay.

    Origin: Introduced by this PR. Adds generation-scoped unloading; loading an overlay does not end the underlying mapping.

    Decision needed: Accept overlay restoration and require producers to explicitly unload mappings they intend to replace permanently.

    Evidence: UniversalProviders.md:70–72 still defines overlay restoration and explicit replacement. NettraceUniversalConverter.cs:115–138 unloads only the named generation's intersecting ranges. microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/process.rs lines 735–750 filter unloads by mapping ID, address, and time.

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    An older reader that ignores ID 6 can parse the trace but continue reporting a symbol after its mapping has ended.

    Origin: Introduced by this PR. Adds unload records without a minimum-reader signal or a compatibility encoding.

    Decision needed: Accept best-effort attribution in old readers, or require a minimum reader, capability signal, or compatible encoding.

    Evidence: UniversalSystemTraceEventParser.cs:100–109,128,143–152 adds the stable unload template and payload; UniversalProviders.md:79 explicitly permits stale attribution in older readers without a completeness signal. microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/formats/nettrace.rs lines 875–891,1253–1263 writes the matching three varints under stable ID 6.

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers - carried from an earlier review; still open.

    Explanation

    An earlier version-78 reader can open the file but misses segmented lifetimes. A new reader can reuse an older cache that does not contain those lifetimes.

    Origin: Partly existing behavior that this PR changes. Adds timeline-backed module lookup without advancing the ETLX reader floor or invalidating existing caches.

    Decision needed: Accept best-effort cross-version lookup and manual regeneration, or enforce compatibility through versioning or cache invalidation.

    Evidence: TraceLog.cs:4265–4277 still uses outer version 78; lines 7708–7711,7905–7927,7943–7949 make the timeline optional and tagged with no new reader floor. FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 still selects cached EventPipe ETLX by timestamp, and UniversalProviders.md:76–77 documents regeneration.

  • [HR-5] Decide whether overlapping CLR and Universal symbol sources are supported - carried from an earlier review; still open.

    Explanation

    At an overlapping address, a deferred CLR method can claim a still-unresolved index, while an index already detached by a mapping transition is available for Universal resolution.

    Origin: Partly existing behavior that this PR changes. Makes code addresses time-scoped without establishing one precedence rule for overlapping CLR and Universal symbols.

    Decision needed: Accept the documented CLR overlap limitation, or define and test which source takes precedence.

    Evidence: TraceLog.cs:2495–2506 applies deferred CLR methods before the converter captures remaining addresses. NettraceUniversalConverter.cs:443–464 can already have removed an address from the unresolved table and assigned it to a Universal generation. UniversalProviders.md:81 retains the CLR overlap disclaimer.

  • [HR-6] Accept the equal-time NetTrace encoding requirement, or normalize lifecycle ordering in the reader - carried from an earlier review; still open.

    Explanation

    A sorted unload can reach the converter before an earlier buffered load at the same timestamp. The unload is then ignored and the later-dispatched load remains mapped. The pinned producer's sorted records and per-process replay ordering avoid that particular inversion.

    Origin: Partly existing behavior that this PR changes. Adds lifecycle dependencies to an existing dispatch model and places the ordering obligation on producers.

    Decision needed: Keep the sorted-record or distinct-timestamp requirement for producers, or normalize equal-time lifecycle dependencies in the reader.

    Evidence: UniversalProviders.md:72–74 still requires dispatch order. EventCache.cs:68–80,175–190 dispatches a sorted record ahead of buffered records at the same timestamp; NettraceUniversalConverter.cs:115–124 still ignores unknown unload IDs. microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/formats/nettrace.rs lines 546–562,923–958 marks records sorted and emits replay stages in order; microsoft/one-collect@8abe09d:one_collect/src/helpers/exporting/process.rs lines 490–550,931–948 orders a same-time unload after its own load.

Code Review Feedback

See 9 new inline comments.

Earlier findings still open:

Earlier simplifications still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 2b319a9996fc.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 2b319a9996fc4b6db4b441b1b5755dc78b2346a9

Since last review (88ef835fef7e -> 2b319a9996fc): 49 fixed, 20 still open, 6 new findings (6 in previously reviewed code), 1 new simplification.

Areas Reviewed

  • Material change: process-instance mapping lifetimes cross the existing Universal reader, TraceLog attribution, public module queries, and ETLX persistence; no external dependency changed.
  • Wire payload, producer ordering, live and offline event and stack rebinding, and process/thread reuse.
  • Native and CLR coexistence, symbol and module identities, ETLX compatibility, and regression fixtures.

Areas Requiring Human Review

  • [HR-7] [HR-7] Define the supported attribution policy for mixed native image and Universal mapping records - carried from an earlier review; still open.

    Explanation

    A live Universal mapping is intended to win at overlapping addresses, with native image lookup available outside it. Native rundown describes a pre-existing image, not a new load. Matching paths and bases do not imply shared module-file metadata.

    Origin: Partly existing behavior that this PR changes. Adds native-load coordination and separate file identities, documents the precedence rule, and exempts native rundown from load-time rebinding.

    Decision needed: Accept and enforce Universal-first attribution, native fallback, and separate identities in mixed traces, or explicitly narrow that guarantee.

    Evidence: TraceLog.cs:7034–7045 gives live Universal mappings priority in public address lookup; NettraceUniversalConverter.cs:465–485 preserves Universal ownership or uses an already-loaded legacy module when separating indexes. TraceLog.cs:7146–7152 now excludes DCStart rundown from the native-load transition, and 11249–11289 separates file identities. ARCH-F02 and ARCH-F03 identify remaining violations of the stated policy, not reasons to treat the decision as settled. src/TraceEvent/EventPipe/UniversalProviders.md:78 (RIGHT), src/TraceEvent/TraceLog.cs:7034-7042 (RIGHT), src/TraceEvent/TraceLog.cs:7146-7152 (RIGHT)

  • [HR-1] [HR-1] [Accept process-local symbol emission or preserve legacy shared-symbol behavior] - carried from an earlier review; still open.

    Explanation

    Two processes can share a mapping ID, but a symbol emitted by only one process now names frames only in that process.

    Origin: Partly existing behavior that this PR changes. Replaces trace-wide symbol fan-out with process-instance resolution and documents producer emission in each process.

    Decision needed: Require per-process symbol emission, or preserve compatibility for older producers that emitted one shared symbol record.

    Evidence: The base converter fanned symbols out to every TraceProcess associated with a mapping ID. Current NettraceUniversalConverter.cs:145–149,245–252 uses only the emitting process and its generation. The pinned producer emits symbols from each replayed mapping with that replay's PID (microsoft/one-collect@79e9f64:one_collect/src/helpers/exporting/formats/nettrace.rs:681–697,894–920,940–949); that does not establish historical producer behavior. src/TraceEvent/EventPipe/UniversalProviders.md:63 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:248-251 (RIGHT)

  • [HR-2] [HR-2] [Confirm overlay restoration and explicit replacement semantics] - carried from an earlier review; still open.

    Explanation

    Unloading the middle of an overlay reveals the older live mapping there without removing either surviving end. Loading another mapping does not permanently remove the one underneath.

    Origin: Introduced by this PR. Adds generation-scoped unloading and makes permanent replacement an explicit producer action.

    Decision needed: Accept overlay restoration and require producers to unload the old mapping explicitly when they intend permanent replacement.

    Evidence: The converter unloads only the named generation's intersecting live ranges (NettraceUniversalConverter.cs:115–138). The pinned producer also excludes the unloaded range by mapping ID and time (microsoft/one-collect@79e9f64:one_collect/src/helpers/exporting/process.rs:735–763). That agrees on restoration, independently of the same-load-tick tie-break mismatch in ARCH-F01. src/TraceEvent/EventPipe/UniversalProviders.md:70 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:137-138 (RIGHT)

  • [HR-3] [HR-3] [Accept stale symbols in older readers or require a compatibility safeguard] - carried from an earlier review; still open.

    Explanation

    An old reader can open the raw trace while ignoring event 6, leaving a symbol visible after its mapping has ended.

    Origin: Introduced by this PR. Adds an unload record without a reader capability marker or a legacy unload encoding.

    Decision needed: Accept potentially stale attribution in older readers, or require a minimum reader, capability signal, or compatible encoding.

    Evidence: The parser adds stable event 6 and three varints (UniversalSystemTraceEventParser.cs:100–109,128,145–152). The pinned exporter writes them (microsoft/one-collect@79e9f64:one_collect/src/helpers/exporting/formats/nettrace.rs:875–891,1253–1263); its Linux export emits unloads without a replacement tombstone (one_collect/src/helpers/exporting/os/linux.rs:1856–1863,1896–1905). UniversalProviders.md:81 states there is no compatibility signal or tombstone mode. src/TraceEvent/EventPipe/UniversalProviders.md:81 (RIGHT), src/TraceEvent/Parsers/UniversalSystemTraceEventParser.cs:100-109 (RIGHT)

  • [HR-4] [HR-4] [Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers] - carried from an earlier review; still open.

    Explanation

    Earlier version-78 readers can open a newer ETLX but miss partial unloads and restored overlays. A newer reader can reopen an older cache without the timeline and cannot reconstruct those lifetimes from the cache alone.

    Origin: Partly existing behavior that this PR changes. Adds persisted segmented lookup without raising the outer reader floor or invalidating older EventPipe caches.

    Decision needed: Accept best-effort cross-version lookup and regeneration from the original trace, or enforce compatibility through versioning or cache invalidation.

    Evidence: TraceLog.cs:4274–4286 retains outer version 78; the tagged TraceLoadedModules extension is optional with minimum reader version 0 (7729–7732,7926–8017). FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 still reuses an EventPipe ETLX cache based on the input timestamp, without checking for lifetime data. src/TraceEvent/EventPipe/UniversalProviders.md:79 (RIGHT), src/TraceEvent/TraceLog.cs:7729-7732 (RIGHT)

  • [HR-5] [HR-5] [Decide whether overlapping CLR and Universal symbol sources are supported] - carried from an earlier review; still open.

    Explanation

    At an overlapping address, a deferred CLR method can claim an index still in the unresolved table, while an index already detached by a mapping transition can instead get a Universal symbol.

    Origin: Partly existing behavior that this PR changes. Time-scopes Universal attribution and separates CLR ModuleID lookup, but leaves overlap attribution without one precedence rule.

    Decision needed: Accept the documented CLR overlap limitation, or specify and test which source owns an overlapping address.

    Evidence: TraceLog.cs:2488–2499 finalizes deferred CLR methods before the converter captures remaining indexes. Earlier mapping transitions can already have removed an index and saved it under a Universal generation (NettraceUniversalConverter.cs:455–472). TraceLog.cs:7502–7506 now excludes Universal rows from CLR ModuleID lookup, but that does not define precedence for overlapping code addresses. src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:459 (RIGHT), src/TraceEvent/TraceLog.cs:7502-7506 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:83 (RIGHT)

  • [HR-6] [HR-6] [Accept the equal-time NetTrace encoding requirement, or normalize lifecycle ordering in the reader] - carried from an earlier review; still open.

    Explanation

    A sorted unload can reach the reader ahead of its earlier-written buffered load at the same tick; the unload is ignored and the mapping remains live. Separately, even correctly ordered same-tick PID reuse cannot distinguish both instances through ETLX's existing PID-and-time Process() lookup.

    Origin: Partly existing behavior that this PR changes. Makes dispatch order significant for mapping lifetimes, requires sorted dependency sequences or distinct ticks, and now documents the remaining PID lookup ambiguity.

    Decision needed: Keep the producer ordering requirement, with distinct ticks when callers need unambiguous PID lookup, or normalize equal-time lifecycle dependencies in the reader.

    Evidence: EventCache.cs:68–80,175–190 dispatches sorted records ahead of buffered records at the same timestamp; the unload handler ignores unknown IDs (NettraceUniversalConverter.cs:115–124). The pinned producer marks replay records sorted and orders same-ID loads before unloads (microsoft/one-collect@79e9f64:one_collect/src/helpers/exporting/formats/nettrace.rs:546–562,923–958; one_collect/src/helpers/exporting/process.rs:529–556,945–962). This verifies that producer's per-process replay, not all writers or historical captures. src/TraceEvent/EventPipe/UniversalProviders.md:70-74 (RIGHT), src/TraceEvent/EventPipe/UniversalProviders.md:77 (RIGHT), src/TraceEvent/SourceConverters/NettraceUniversalConverter.cs:120-124 (RIGHT)

Code Review Feedback

Earlier findings still open:

Earlier simplifications still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved

@brianrob Brian Robbins (brianrob) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation

Changes Recommended; Human Review Required

Reviewed commit 09eb8396252e.

PR: #2510

Base: 8ba00fcc2ab6706850b5eb45464b91b83d7c39e7; Head: 09eb8396252e0e8351a07a4e51fab519e6b80a2f

Since last review (2b319a9996fc -> 09eb8396252e): 24 fixed, 21 still open, 6 new findings (3 in previously reviewed code), 1 new simplification.

Areas Reviewed

  • Material change: process-instance mapping lifetimes cross the parser, TraceLog attribution, public module queries, and ETLX persistence; no external dependency changed.
  • Wire format and producer replay, process and thread reuse, and live and offline stack and event attribution.
  • Native and CLR coexistence, module identity and lifetime, ETLX compatibility, and regression fixtures.

Areas Requiring Human Review

  • [HR-7] Define the supported attribution policy for mixed native image and Universal mapping records - carried from an earlier review; still open.

    Explanation

    A live Universal range is intended to win at overlapping addresses. An already-loaded native image can supply attribution elsewhere, and equal paths and bases do not merge file metadata.

    Origin: Partly existing behavior that this PR changes. Adds Universal-first lookup, native load and unload coordination, and separate file identities. The current iteration guards native unload against claiming a live Universal index but does not settle the policy.

    Decision needed: Accept and enforce Universal-first attribution, time-correct native fallback, and separate identities in mixed traces, or explicitly narrow that guarantee.

    Evidence: TraceLog.cs:7035–7048 prioritizes the live Universal timeline in public address lookup; lines 7148–7155 separate ordinary native loads from rundown, and lines 7233–7241 keep native unload from claiming indexes covered by a live Universal mapping. Lines 11256–11294 split file identity caches. The current native-load lazy-lookup defect still violates the historical fallback rule stated in UniversalProviders.md:78.

  • [HR-1] Accept process-local symbol emission or preserve legacy shared-symbol behavior - carried from an earlier review; still open.

    Explanation

    Two processes can share a mapping ID, but a symbol emitted for only one no longer names frames in the other.

    Origin: Partly existing behavior that this PR changes. Replaces trace-wide fan-out with process-instance resolution. The pinned producer emits per process; that does not establish historical producer behavior.

    Decision needed: Require per-process symbol emission, or preserve compatibility for older writers that emitted a shared symbol only once.

    Evidence: At the shared merge base, NettraceUniversalConverter.AfterProcess fanned a symbol out to all processes registered for the mapping ID. Current NettraceUniversalConverter.cs:145–149,242–252 binds it only to the emitting TraceProcess and that process's generation. UniversalProviders.md:63 makes per-process emission explicit. microsoft/one-collect@39d2c74:one_collect/src/helpers/exporting/formats/nettrace.rs:681–697,894–920,940–949 emits each replayed mapping's symbols under its process PID.

  • [HR-2] Confirm overlay restoration and explicit replacement semantics - carried from an earlier review; still open.

    Explanation

    Unloading the middle of an overlay reveals the older mapping only in that interval, leaving both ends of the overlay intact.

    Origin: Introduced by this PR. Adds explicit, range-scoped unloads; a new mapping does not permanently invalidate an older one underneath it.

    Decision needed: Accept overlay restoration and require producers to unload the older mapping explicitly when they intend permanent replacement.

    Evidence: UniversalProviders.md:70 and NettraceUniversalConverter.cs:115–138,701–714 make unload generation-specific and choose the newest surviving generation. microsoft/one-collect@39d2c74:one_collect/src/helpers/exporting/process.rs:735–763 checks unload by ID, address and time; its equal-time fixture at 1520–1559 explicitly checks replay precedence against lookup. The pinned producer evidence supports the policy; it does not settle it.

  • [HR-3] Accept stale symbols in older readers or require a compatibility safeguard - carried from an earlier review; still open.

    Explanation

    An older reader can parse the raw trace while missing the unload, so it may continue attributing samples to expired code.

    Origin: Introduced by this PR. Adds an optional wire event without a minimum-reader signal or a legacy unload encoding.

    Decision needed: Accept potentially stale attribution in older readers, or require a minimum reader, capability signal, or compatible encoding.

    Evidence: UniversalSystemTraceEventParser.cs:100–109,128,145–152 adds stable event 6 with three varints; UniversalProviders.md:81 states that older readers can ignore it and describes the absence of a capability or tombstone mode. microsoft/one-collect@39d2c74:one_collect/src/helpers/exporting/formats/nettrace.rs:875–891,1253–1263 writes that record. microsoft/one-collect@39d2c74:one_collect/src/helpers/exporting/os/linux.rs:1858–1865,1898–1907 emits Linux dynamic mapping unloads without replacement mappings.

  • [HR-4] Accept the segmented ETLX lifetime contract and compatibility policy for earlier version-78 readers - carried from an earlier review; still open.

    Explanation

    An earlier version-78 reader can open a newer ETLX without seeing partial unloads or restored overlays. A newer reader can reopen an older cache but cannot reconstruct those lifetimes from the cache alone.

    Origin: Partly existing behavior that this PR changes. Persists segmented lifetimes without raising the outer reader floor or invalidating older EventPipe caches.

    Decision needed: Accept best-effort cross-version lookup and regeneration from the original trace, or enforce compatibility through versioning or cache invalidation.

    Evidence: TraceLog.cs:4274–4286 keeps the outer version at 78. Lines 7733–7736 and 7931–8022 append and conditionally read a tagged timeline with minimum reader version 0. FastSerialization.cs:2059–2132 skips trailing tagged fields. PerfViewData.cs:10300–10324 still reuses an EventPipe ETLX cache based on file timestamps, not timeline presence. UniversalProviders.md:79 calls for regeneration.

  • [HR-5] Decide whether overlapping CLR and Universal symbol sources are supported - carried from an earlier review; still open.

    Explanation

    A deferred CLR method can claim an overlapping address index still in the unresolved table, while a mapping transition can already have separated another index for Universal symbol resolution.

    Origin: Partly existing behavior that this PR changes. Adds time-scoped Universal attribution and separates CLR ModuleID lookup without defining one priority for overlapping code addresses.

    Decision needed: Accept the documented CLR overlap limitation, or specify and test which source owns an overlapping address.

    Evidence: TraceLog.cs:2488–2499 finalizes deferred CLR methods before the converter captures remaining indexes. NettraceUniversalConverter.cs:464–487 can already have separated an overlapping index into a Universal generation. TraceLog.cs:7507–7511 prevents Universal rows from shadowing CLR ModuleIDs, but does not choose address-level precedence. UniversalProviders.md:83 explicitly limits the overlap guarantee.

  • [HR-6] Accept the equal-time NetTrace encoding requirement, or normalize lifecycle ordering in the reader - carried from an earlier review; still open.

    Explanation

    A sorted unload can overtake its earlier-written buffered load, leaving the mapping live. Even correctly ordered same-tick PID reuse cannot distinguish both instances through the public PID-and-time query.

    Origin: Partly existing behavior that this PR changes. Makes dispatch order significant for mapping lifetimes and documents sorted dependency sequences or distinct ticks.

    Decision needed: Keep the producer ordering requirement, with distinct ticks when callers need unambiguous PID lookup, or normalize equal-time lifecycle dependencies in the reader.

    Evidence: EventCache.cs:68–80,175–190 dispatches a sorted record ahead of buffered records at the same tick; NettraceUniversalConverter.cs:119–124 ignores unloads whose mapping is not known yet. UniversalProviders.md:72–77 documents both dispatch ordering and the public equal-time PID lookup limitation. microsoft/one-collect@39d2c74:one_collect/src/helpers/exporting/formats/nettrace.rs:546–562,923–958 uses sorted replay records, and microsoft/one-collect@39d2c74:one_collect/src/helpers/exporting/process.rs:529–556,945–962 orders a mapping's same-tick load before its unload. TraceLog.cs:6709–6731 preserves an inferred thread boundary but does not change the PID-and-time process query.

Code Review Feedback

Earlier findings still open:

Earlier simplifications still open:


Written by Robert Bobby (Brianrob's Code Review Bot).

Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Comment thread src/TraceEvent/TraceLog.cs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant