Skip to content

constellation: Wait for canvas thread to shut down before shutting down system font service#37182

Merged
mrobinson merged 1 commit intoservo:mainfrom
mrobinson:wait-for-canvas-shutdown
May 30, 2025
Merged

constellation: Wait for canvas thread to shut down before shutting down system font service#37182
mrobinson merged 1 commit intoservo:mainfrom
mrobinson:wait-for-canvas-shutdown

Conversation

@mrobinson
Copy link
Copy Markdown
Member

The canvas thread might need access to the system font service before it
shuts down. Ensure that it finishes shutting down before triggering the
shutdown of the system font service. This should avoid issues where
canvas tries to access fonts right before shutting down.

Fixes: #36849.
Testing: Since this fixes a flaky crash on shutdown, there isn't a good
way to write a test for it.

…wn system font service

The canvas thread might need access to the system font service before it
shuts down. Ensure that it finishes shutting down before triggering the
shutdown of the system font service. This should avoid issues where
canvas tries to access fonts right before shutting down.

Fixes: servo#36849.
Signed-off-by: Martin Robinson <[email protected]>

// Wait for the canvas thread to exit before shutting down the font service, as
// canvas might still be using the system font service before shutting down.
let _ = canvas_exit_receiver.recv();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we check error here?

Copy link
Copy Markdown
Member Author

@mrobinson mrobinson May 30, 2025

Choose a reason for hiding this comment

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

This is happening in the process of shutdown, so an error here likely means that the canvas thread has panicked or deadlocked, in which case I think the right thing to do is to keep trying to shut down. What we are doing is trying to ensure that the canvas thread won't be contacting the system font service any longer. If the canvas thread has panicked or deadlocked, this is guaranteed.

@mrobinson mrobinson marked this pull request as ready for review May 30, 2025 11:06
@mrobinson
Copy link
Copy Markdown
Member Author

Marking this as ready for review. I cannot reproduce the original crash, but I'm almost certain that this fixes it. Perhaps @fred-wang can confirm.

@mrobinson mrobinson added this pull request to the merge queue May 30, 2025
@mrobinson
Copy link
Copy Markdown
Member Author

It looks like the unit test failure was an infrastructure issue.

Merged via the queue into servo:main with commit 578c52f May 30, 2025
21 checks passed
@mrobinson mrobinson deleted the wait-for-canvas-shutdown branch May 30, 2025 12:34
vlindhol added a commit to vlindhol/servo that referenced this pull request Jun 1, 2025
* main: (510 commits)
  DevTools: Fix empty `debugger > source` panel (servo#37197)
  dom: implement signal abort on controller and signal (servo#37192)
  build(deps): bump parking_lot from 0.12.3 to 0.12.4 (servo#37199)
  layout: Split overflow calculation after fragment tree construction (servo#37203)
  build(deps): bump parking_lot_core from 0.9.10 to 0.9.11 (servo#37202)
  build(deps): bump lock_api from 0.4.12 to 0.4.13 (servo#37201)
  build(deps): bump cc from 1.2.24 to 1.2.25 (servo#37198)
  Constellation can now optionally report memory usage when the page is loaded. (servo#37151)
  Implement Input `type=text` UA Shadow DOM (servo#37065)
  constellation: Wait for canvas thread to shut down before shutting down system font service (servo#37182)
  Add slot default display style test (servo#37189)
  Send synthetic keydown/keyup at ime_insert_text (servo#37175)
  script: Let canvas serialization to image fail gracefully (servo#37184)
  Implement basics of link preloading (servo#37036)
  compositor: Add an initial RefreshDriver (servo#37169)
  pixels: Add limitation to max image total bytes length (servo#37172)
  Chore: Remove unused variable in `transition-zero-duration-with-delay.html` (servo#37179)
  build(deps): bump ohos-ime from 0.2.0 to 0.3.0 (servo#37180)
  Add a user agent style for the `<slot>` element (servo#37174)
  build(deps): bump hitrace from 0.1.4 to 0.1.5 (servo#37170)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants