Repository navigation
Conversation
TraceLayerTest.FollowsTheBackingScaleWithNoSizeChange crashed twice on the macOS 15 runner, once in the merge queue, which ejected the pull request. The crash is inside QuartzCore: the render server tells a shown layer's Metal display link which display it is on, on Core Animation's own queue, and below macOS 27 a message handled while the link is being invalidated reads the layer that the invalidation has just cleared. The test shows a layer, changes it and destroys it at once, so the message can still be in flight when the link is invalidated. The trace layer tests now wait 250 ms before destroying a layer, in their teardown and in the two tests that destroy one midway, so the message is handled while the link still has its layer. This narrows the race rather than removing it; nothing signals the message. The product's close path is unchanged. Verified: the TraceLayer tests pass in the dev and TSan builds. The race cannot be reproduced on macOS 27, whose QuartzCore checks for the cleared layer. Prior art: alpine-gpui PR #644 (same fault, notifyDisplayChange:+152 at 0x20 on CI runners, macOS 26.6.2; "Only shown layers get these messages"; moving invalidate() away from the show "narrows the race"), QuartzCore disassembly on macOS 27.2 (MetalLinkItem::invalidate clears the layer before leaving the link list); Apple's CAMetalDisplayLink docs list no known issue.
AI review: no Important findingsPR 446 changes only editor/tests/TraceLayerTests.mm. It adds a destroyLayer() helper that runs the run loop for a fixed 250 ms before resetting a shown TraceLayer, so the CAMetalDisplayLink is not invalidated while a render-server display message is still pending, which crashes on macOS below 27 (#445). The correctness, rules, tests and real-time specialists each reviewed the diff against the pr-head/ files and the base branch's REVIEW.md, CLAUDE.md and .claude/rules.
1 finding(s) not confirmed as Important by verification
Why the finding does not hold:
At most this is a nit: the same 250 ms settle could sit in a shared test helper that NativeTracesTest also uses. Nothing in the code shows a defect that reaches a user and comes from this change. The author's answers file (ai-review/answers.json) is empty, so no earlier answer covers this finding. Fix or answer each Important finding. A maintainer can comment |
TraceLayerTest.FollowsTheBackingScaleWithNoSizeChangecrashed twice on the macOS 15 runner, once in the merge queue. The crash is inside QuartzCore, not our code. The render server tells a shown layer's Metal display link which display it is on, on Core Animation's own queue. Below macOS 27, a message handled while the link is being invalidated reads the layer thatinvalidate()has just cleared. The test shows a layer, changes it and destroys it at once. Cause and evidence (two CI stacks, QuartzCore disassembly, alpine-gpui's identical crash) are in the issue.The trace layer tests now wait 250 ms before destroying a layer: in
TearDownand in the two tests that destroy one midway. The wait narrows the race; it does not remove it, since nothing signals the message.Verified: the TraceLayer tests (20) in the dev and TSan builds. Locally one dev run had
AsksForEachFrameOnTheRenderThreadInTimefail on a stalled display mid-test, before teardown; it passed 3 of 3 on rerun. The race cannot be reproduced on macOS 27, whose QuartzCore checks for the cleared layer. Not run locally:scripts/check.shandnpm run test:app(test-only C++ change).Considered and not done
LayerMac::~LayerMacinvalidating the link at once) has the same race on macOS 14 to 26: closing the editor within milliseconds of the render server's display message could crash the host. Movinginvalidate()later only narrows it, and a lingering thread risks a host unloading the bundle first. Left for a separate decision.Closes #445