Repository navigation
fix(runtime): leak probe review fixes - #591
Draft
edusperoni wants to merge 1 commit into
Draft
edusperoni wants to merge 1 commit into
edusperoni wants to merge 1 commit into
Conversation
- Settle before every snapshot: findLeakCycles and the cycles, strict and inspect triggers run three full collections, each followed by the queued releases and a synchronous drain of deallocated canary records. A wrapper that dies in the snapshot's own collection reports its queued retains (Instance.queued), so its object is neither listed as changed nor stripped of its root status, and the pending retain counts as the runtime's. - Model the object a resurrecting wrapper lives for: an ns:kept edge from the object to a GC-protected wrapper behind a weak handle, excluded from the two-node loop check like ns:owned. - The state handles of canary records whose object is being or was deallocated are the runtime's handles, not roots. - Scope the handles EdgeName and NodeName make. - LeakProbe SPI version 3. - Docs: settling, ns:kept, and the JS block disposal race as a limitation.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes in the leak probe (#576). These are issues the Android port's review found (NativeScript/android#2130), checked against the iOS code. Each new spec fails without its fix.
Fixes
findLeakCycles()and the cycles and strict Darwin triggers took the snapshot right away; only the counts and inspect triggers settled.canarymode: a canary that died in the snapshot's own GC has its handle reset while itsInstancesentry and the runtime's queued +1 remain. Its object was listed aschangedand lost its root status, so cycles through an outside-owned object came backuncertainwith the wrong reason. Inrootedmode the queued +1 read as an outside owner and hid cycles.-deallocs; the docs say so.Instance.queuedfield gives the count of retains still queued for dead wrappers, per object. A queued seed is not marked changed, and its pending retains count as the runtime's.ns:keptedge. Inresurrectingmode, a TS/@NativeClass-extended wrapper that native code retains is GC-protected but sits behind a weak handle. The graph had no edge from its object to it, so cycles through the wrapper's JS were reported while the object was owned from outside. The object now has anns:keptedge to the wrapper, excluded from the two-node loop check likens:owned.EdgeNameandNodeNameopen their ownHandleScope, so the walk no longer accumulates a handle per edge.LeakProbeSPI.hgoes to version 3, for the newInstance.queuedfield and host visitor.Not affected on iOS, unlike Android: the "(Global handles)" edge filter, the
ClearObjectIdsguard (iOS checks whether the context already had an id), the ephemeron edge prefix, and truncation.A JS block whose
kBlockDeallocatingbit is set while it waits for the runtime's lock still reads as a root. That is documented as a limitation.Specs (
WrapperLifetimeLeaksTests.js)canaryonly: an object whose canary just died, probed right after__collect()with no settle, is notchangedand has no cycle reported.canaryonly: a cycle shared with an owner released in the same turn is still found.__extends) held by an owner the probe can't see, with a JS ↔ block cycle through its wrapper, is not reported.Testing
2161 specs, 0 failures in
resurrecting/extended,rooted/all,canary/all,canary/extended, andcanary/allunder ASan. Specs (1) and (3) failed on main under canary; spec (2) failed on main in default mode.