Skip to content

constellation: join on script-threads - #38424

Merged
gterzian merged 3 commits into
servo:mainfrom
gterzian:join_script_threads
Aug 6, 2025
Merged

gterzian merged 3 commits into
servo:mainfrom
gterzian:join_script_threads

Conversation

@gterzian

@gterzian gterzian commented Aug 2, 2025 •

Copy link
Copy Markdown
Member

We currently send exit signals to script-threads, and we also join on the BHM worker. This ensure the constellation shuts-down only after script has dropped it's sender to the BHM worker. By joining on the script-threads, we have a guarantee that they have exited(which is stronger than having dropped their senders) by the time the constellation exits.

Testing: Manually opened many tabs and closed the window, both in single- and multi-process modes.
Fixes: Part of - #30849

@gterzian
gterzian requested review from Taym95 and jdm August 2, 2025 01:41
@gterzian
gterzian marked this pull request as draft August 2, 2025 02:06
@gterzian

gterzian commented Aug 2, 2025 •

Copy link
Copy Markdown
Member Author

I'm not sure about this one because it means we are leaking the join handles until final shutdown, whereas a user could open and close any number of pipelines before then.

EDIT: addressed this by switching to a map of webview to join handle.

@gterzian
gterzian force-pushed the join_script_threads branch 3 times, most recently from 76ffcfb to 77d1c2c Compare August 2, 2025 08:46
@gterzian
gterzian marked this pull request as ready for review August 2, 2025 08:47

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice change!

for (_, join_handle) in self.script_join_handles.drain() {
join_handle
.join()
.expect("Failed to join on a script-thread.");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is worth panicking over. Log an error instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, I've done it for the bhm thread join as well then.

@gterzian
gterzian force-pushed the join_script_threads branch from 521eea4 to 08f89ad Compare August 6, 2025 11:20
@gterzian
gterzian added this pull request to the merge queue Aug 6, 2025
Merged via the queue into servo:main with commit a99ad24 Aug 6, 2025
@gterzian
gterzian deleted the join_script_threads branch August 6, 2025 18:59
PotatoCP added a commit to PotatoCP/servo that referenced this pull request Aug 7, 2025
{"fail_fast": false, "matrix": [{"name": "Linux (WPT)", "workflow": "linux", "wpt": true, "profile": "release", "unit_tests": false, "build_libservo": false, "bencher": false, "build_args": "", "wpt_args": "./tests/wpt/tests/webdriver/tests/classic/ --product servodriver --headless --processes 1", "number_of_wpt_chunks": 2}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants