You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[wasm][R2R] Objects outlive the expected GC under ReadyToRun, breaking finalization/resurrection tests (Samples/gc, arrres_il_r) #134994
Under browser-wasm CoreCLR ReadyToRun (test code compiled with crossgen2), two GC finalization tests fail. In both, an object that should be unreachable at a GC.Collect() survives it and is finalized only at a later collection.
GC/Scenarios/Samples/gc (GC-scenarios1, out of process). The Introduction demo's objects are not finalized by the GC.Collect() + WaitForPendingFinalizers() that follows them. They are finalized one collection later, inside the Resurrection demo. The resurrection object is likewise not finalized at its collection, so ResObjHolder is still null:
Demo start: Object Resurrection.
Obj(Resurrection): BaseObj Constructor
Obj(Resurrection): ResurrectObj Constructor
Forcing a garbage collection
Waiting for Finalizers to complete
Obj(Introduction): DerivedObj Finalize
Obj(Introduction): BaseObj Finalize
...
Finalizers are complete
System.NullReferenceException: Object reference not set to an instance of an object.
at Application.ResurrectionDemo()
at Application.TestEntryPoint()
JIT/Methodical/Arrays/misc/arrres_il_r (Methodical_r1, out of process). The test throws when the finalizer has not run and resurrected the object after a collection:
Unhandled exception. System.Exception: Exception of type 'System.Exception' was thrown.
at GCTest_arrres_il.Test.Main()
Aborted(native code called abort())
arrres_il_r already notes that it depends on fully optimized code reporting precise lifetimes (JitOptimizationSensitive). It also fails in crossgen composite lanes (#109311).
Both tests pass in the browser-wasm interpreter leg, so this is specific to test code compiled with ReadyToRun on wasm. A likely cause is that wasm R2R reports a stack slot as live for longer than the object's actual lifetime. Compare #134803, where wasm reports stack roots as pinned.
Description
Under browser-wasm CoreCLR ReadyToRun (test code compiled with crossgen2), two GC finalization tests fail. In both, an object that should be unreachable at a
GC.Collect()survives it and is finalized only at a later collection.GC/Scenarios/Samples/gc(GC-scenarios1, out of process). The Introduction demo's objects are not finalized by theGC.Collect()+WaitForPendingFinalizers()that follows them. They are finalized one collection later, inside the Resurrection demo. The resurrection object is likewise not finalized at its collection, soResObjHolderis stillnull:JIT/Methodical/Arrays/misc/arrres_il_r(Methodical_r1, out of process). The test throws when the finalizer has not run and resurrected the object after a collection:arrres_il_ralready notes that it depends on fully optimized code reporting precise lifetimes (JitOptimizationSensitive). It also fails in crossgen composite lanes (#109311).Both tests pass in the browser-wasm interpreter leg, so this is specific to test code compiled with ReadyToRun on wasm. A likely cause is that wasm R2R reports a stack slot as live for longer than the object's actual lifetime. Compare #134803, where wasm reports stack roots as pinned.
Configuration
R2R_CG2, priority 1runtime-coreclr outerloopon [wasm][CoreCLR] Add browser_wasm R2R_CG2 leg to runtime-coreclr outerloop #134960: build 1618757, Helix jobde142d1f-704d-4976-80ab-a718a4a6635cNote
This issue was drafted with GitHub Copilot assistance.