servo / servo

Servo, the embeddable, independent, memory-safe, modular, parallel web rendering engine
https://servo.org
Mozilla Public License 2.0
28.31k stars 3.02k forks source link

GC borrow hazard in Document::gather_active_resize_observations_at_depth #34015

Open jdm opened 22 hours ago

jdm commented 22 hours ago

There's a loop over the elements of a vector that are mutably borrowed, and then we call a method that can GC on each element.

https://github.com/servo/servo/blob/main/components/script/dom/document.rs#L3065

jdm commented 20 hours ago

I suspect this is observable with:

  1. ./mach build -d --debug-mozjs
  2. ./mach test-wpt /resize-observer/observe.html --pref js.mem.gc.zeal.level=2 --pref js.mem.gc.zeal.frequency=1 --headless --timeout-multiplier=10
jdm commented 19 hours ago

Ok, the tests in /resize-obsever/ are not enough to tickle this particular hazard because it requires a very precise setup:

This is an impossible combination, I believe. It makes me want to find a way to remove the use of document.Fonts() from Window::reflow, since that's the only use of a CanGc marker and it's the reason this looks like a GC borrow hazard.