Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a sanity check for render task sizes #2956

Merged
merged 2 commits into from Aug 9, 2018
Merged

Conversation

@nical
Copy link
Collaborator

nical commented Aug 8, 2018

This PR moves the crash happening when failing to allocate large render task textures to the place where the size is assigned in the hope that the stack trace will be more actionable. This will make it easier to investigate #2955.

I'm not sure whether the explicit panic!() is needed or if the error!() macro already panics.


This change is Reviewable

if size.width > RENDER_TASK_SIZE_SANITY_CHECK ||
size.height > RENDER_TASK_SIZE_SANITY_CHECK {
error!("Attempting to create a render task of size {}x{}", size.width, size.height);
panic!();

This comment has been minimized.

@kvark

kvark Aug 8, 2018

Member

let's just have this message in panic!

This comment has been minimized.

@nical

nical Aug 9, 2018

Author Collaborator

The reason I put it in error!() is that it gets logged in a special gfxCriticalError thing which I can search for in crash-stats. I don't know how to search through panic messages in crash-stats although it might be possible.

@@ -458,6 +470,8 @@ impl RenderTask {
}
}

render_task_sanity_check(&outer_rect.size);

This comment has been minimized.

@kvark

kvark Aug 8, 2018

Member

would it be easier (and more robust) if we just had a constructor like RenderTask::new_dynamic(size, kind, clear_mode, children) where the check is done?

This comment has been minimized.

@nical

nical Aug 9, 2018

Author Collaborator

I have a mild preference towards keeping the struct initialization syntax instead of using ::new methods when construction is simple because the latter isn't very easy to read due to the lack of named arguments.
My hope is that within a few weeks of this sanity check being in the wild we'll have data pointing us to the missing places where we need to be careful about render task sizes and we can then remove the check (or replace it with something a bit better where we check against the real maximum size or something that makes sense on a per-type-of-item basis).

This comment has been minimized.

@kvark

kvark Aug 9, 2018

Member

I have a mild preference towards keeping the struct initialization syntax instead of using ::new methods when construction is simple

I agree! In my book the reasoning no longer stands if there is any logic that needs to be done though, which is the case here.

and we can then remove the check

I don't see why we'd want to remove the check ever. Better put it once and forever in a nice spot to protect us against eternal evils of infinite render tasks.

This comment has been minimized.

@nical

nical Aug 9, 2018

Author Collaborator

My own book has it that it's not worth losing the readability for a single sanity check function call that is only there for debugging purposes, but that's not really worth arguing over, I'll add the constructor.

This comment has been minimized.

@kvark

kvark Aug 9, 2018

Member

I don't understand where "losing the readability" comes from. What am I missing?

This comment has been minimized.

@kvark

kvark Aug 9, 2018

Member

oh, I was misreading it as "reliability", silly me

@nical nical force-pushed the nical:large-rendertask branch from abd86de to 2dd663e Aug 9, 2018
@kvark
kvark approved these changes Aug 9, 2018
@kvark
Copy link
Member

kvark commented Aug 9, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Aug 9, 2018

📌 Commit 2dd663e has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Aug 9, 2018

Testing commit 2dd663e with merge e475061...

bors-servo added a commit that referenced this pull request Aug 9, 2018
Add a sanity check for render task sizes

This PR moves the crash happening when failing to allocate large render task textures to the place where the size is assigned in the hope that the stack trace will be more actionable. This will make it easier to investigate #2955.

I'm not sure whether the explicit `panic!()` is needed or if the `error!()` macro already panics.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2956)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 9, 2018

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing e475061 to master...

@bors-servo bors-servo merged commit 2dd663e into servo:master Aug 9, 2018
3 checks passed
3 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
@gw3583
Copy link
Collaborator

gw3583 commented Aug 10, 2018

@nical @kvark This explicit panic occurs during the crash tests in CI. It may not be the same as the crash we're looking for, but I imagine it should be an easy fix:

thread 'WRRenderBackend#3' panicked at 'explicit panic', gfx/webrender/src/render_task.rs:43:9
TEST-UNEXPECTED-FAIL | file:///Users/cltbld/tasks/task_1533871261/build/tests/reftest/tests/layout/base/crashtests/265973-1.html | application terminated with exit code 1
REFTEST PROCESS-CRASH | file:///Users/cltbld/tasks/task_1533871261/build/tests/reftest/tests/layout/base/crashtests/265973-1.html | application crashed [@ mozalloc_abort]
Return code: 1
No suite end message was emitted by this harness.
# TBPL FAILURE #
The reftest suite: crashtest ran with return status: FAILURE
[taskcluster:error] exit status 2
@gw3583
Copy link
Collaborator

gw3583 commented Aug 10, 2018

Ah, I wonder if in this case it might be a false positive - it's possible that the size of the root render task gets set very large if the window size is very large, even though the root render task doesn't allocate any targets. Although .. that should get picked up before any render tasks get allocated, I think, so maybe that's not it.

@nical nical deleted the nical:large-rendertask branch Aug 10, 2018
@nical
Copy link
Collaborator Author

nical commented Aug 10, 2018

Link ot the failing try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b313719e75e0e1f9169cd8f6c38cc227d7d21cb0&selectedJob=193217773

The crashtest is:

<html>
<head>
</head>

<body>
<iframe style="border-top-width: 31378748; border-bottom-right-radius: 23895784; ">
</body>
</html>

Looking into it.

@nical
Copy link
Collaborator Author

nical commented Aug 10, 2018

So the crash is very similar to what was fixed in #2916 except that in this instance it is the border width and not the border radius that causes us to allocate a huge render task. I'll put a fix up today.

bors-servo added a commit that referenced this pull request Aug 10, 2018
Prevent border widths to allocate huge render task surfaces.

Following up from #2956 this PR makes us scale down the the intermediate render task we use to rasterize borders if the width is larger than 2k, just like we do with border radii.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2966)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.