Skip to content

canvas: Fix response panic on closed channel - #45310

Merged
sagudev merged 1 commit into
servo:mainfrom
shangguanmachine-dot:main
Jun 2, 2026
Merged

sagudev merged 1 commit into
servo:mainfrom
shangguanmachine-dot:main

Conversation

@shangguanmachine-dot

@shangguanmachine-dot shangguanmachine-dot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

The canvas paint thread could panic when attempting to send responses through channels that have already been closed by the receiver
Replace .unwrap() calls with proper error handling using if let Err(error). Log warnings instead of panicking when channel send operations fail.

Part of #40744

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 2, 2026
@yezhizhen yezhizhen changed the title Fix canvas response panic on closed channel canvas: Fix response panic on closed channel Jun 2, 2026

@yezhizhen yezhizhen 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.

I wonder if these can really fail. But nothing to lose by unwrap less.

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jun 2, 2026
@jschwe

jschwe commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

I wonder if these can really fail. But nothing to lose by unwrap less.

If you add a long sleep before the send, and close the page with the canvas during the sleep duration, that could be a reproducer.

@jschwe

jschwe commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Both of the usages are sync receives, so at least right now the send can't fail (unless script is panicking due to another reason in that short window), but unwrapping less is probably better.

@sagudev
sagudev added this pull request to the merge queue Jun 2, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 2, 2026
Merged via the queue into servo:main with commit adb5c21 Jun 2, 2026
32 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 2, 2026
jschwe pushed a commit to jschwe/servo that referenced this pull request Jun 26, 2026
The canvas paint thread could panic when attempting to send responses
through channels that have already been closed by the receiver
Replace .unwrap() calls with proper error handling using if let
Err(error). Log warnings instead of panicking when channel send
operations fail.

Part of servo#40744

Signed-off-by: shangguanmachine-dot <[email protected]>
Co-authored-by: shangguanmachine-dot <[email protected]>
(cherry picked from commit adb5c21)
jschwe pushed a commit that referenced this pull request Jun 26, 2026
The canvas paint thread could panic when attempting to send responses
through channels that have already been closed by the receiver
Replace .unwrap() calls with proper error handling using if let
Err(error). Log warnings instead of panicking when channel send
operations fail.

Part of #40744

Signed-off-by: shangguanmachine-dot <[email protected]>
Co-authored-by: shangguanmachine-dot <[email protected]>
(cherry picked from commit adb5c21)
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.

5 participants