Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a sanity check for render task sizes #2956
Conversation
| 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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
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.
This comment has been minimized.
kvark
Aug 9, 2018
Member
I don't understand where "losing the readability" comes from. What am I missing?
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r+ |
|
|
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 -->
|
|
|
@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:
|
|
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. |
|
Link ot the failing try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b313719e75e0e1f9169cd8f6c38cc227d7d21cb0&selectedJob=193217773 The crashtest is:
Looking into it. |
|
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. |
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 -->
nical commentedAug 8, 2018
•
edited by larsbergstrom
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 theerror!()macro already panics.This change is