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

assertion failed: !self.Document().needs_reflow() || (!for_display && self.Document().needs_paint()) || self.window_size.get().is_none() || self.suppress_reflow.get() #14239

Open
julen opened this issue Nov 15, 2016 · 8 comments

Comments

@julen
Copy link

@julen julen commented Nov 15, 2016

assertion failed: !self.Document().needs_reflow() ||
(!for_display && self.Document().needs_paint()) ||
self.window_size.get().is_none() || self.suppress_reflow.get()

URL:

Servo Version:

Servo 0.0.1-9467fbe

Backtrace:


WARNING: <ScriptThread PipelineId { namespace_id: PipelineNamespaceId(1), index: PipelineIndex(7) }>: Panic hook called.
ERROR: assertion failed: !self.Document().needs_reflow() ||
    (!for_display && self.Document().needs_paint()) ||
    self.window_size.get().is_none() || self.suppress_reflow.get()

stack backtrace:
   0:        0x1049f479e - backtrace::backtrace::trace::h16372ee7bf1517e5
   1:        0x1049f4a8c - backtrace::capture::Backtrace::new::hcc43c50c4b11c693
   2:        0x10399eec5 - constellation::constellation::log_entry::h7688487812ed581e
   3:        0x10399dd92 - _<constellation..constellation..FromCompositorLogger as log..Log>::log::h58738eb446c241c5
   4:        0x1051f1f41 - log::__log::h4d9758b2ad9415f2
   5:        0x103897a20 - servo::main::_{{closure}}::h7b5afb0651e4dbf9
   6:        0x1052ab363 - std::panicking::rust_panic_with_hook::h00b81bb3dcbd51f2
   7:        0x103b29ff4 - std::panicking::begin_panic::h70ee11343cda1bc2
   8:        0x103fc9317 - script::dom::window::Window::reflow::h59e8fabf0d7c1411
   9:        0x104007261 - script::script_thread::ScriptThread::parsing_complete::h5c4f367ed81739ae
  10:        0x103f73d51 - script::dom::servoparser::ServoParser::parse_sync::h9b41f9d6b89f4cb3
  11:        0x103e3d035 - script::dom::document::Document::finish_load::haf7e93f96bac237f
  12:        0x103ef4dab - _<script..dom..htmlscriptelement..ScriptContext as net_traits..FetchResponseListener>::process_response_eof::h4c634eec70011e77
  13:        0x103ff155a - _<script..network_listener..ListenerRunnable<A, Listener> as script..script_thread..Runnable>::handler::h0a87d3121eaf1cea
  14:        0x103ffdee2 - _<script..script_thread..CancellableRunnable<T> as script..script_thread..Runnable>::handler::h856c5fb0d3677403
  15:        0x104016491 - script::script_thread::ScriptThread::handle_msg_from_script::hb5985b3f26e57008
  16:        0x1041bba2c - script::script_thread::ScriptThread::handle_msgs::_{{closure}}::he8671bfcc2dc7fe4
  17:        0x10400db3c - script::script_thread::ScriptThread::handle_msgs::h037132b740e14481
  18:        0x103b98f37 - std::panicking::try::do_call::h4551f83c1492c961
  19:        0x1052ac38a - __rust_maybe_catch_panic
  20:        0x103d33356 - _<F as alloc..boxed..FnBox<A>>::call_box::h90d7124476665b18
  21:        0x1052aa214 - std::sys::thread::Thread::new::thread_start::h9fa66f6812e81e10
  22:     0x7fff8104799c - _pthread_body
  23:     0x7fff81047919 - _pthread_start

This report was generated by the browser.html issue reporter.

@jdm jdm added the I-panic label Nov 15, 2016
@jdm
Copy link
Member

@jdm jdm commented Dec 13, 2016

@julen Do you have any idea what website you were looking at?

@julen
Copy link
Author

@julen julen commented Dec 13, 2016

To be honest I don't remember, although it might be one of the demos listed on the start page. I'm sorry I cannot be more accurate, it's been a long time since the crash... ¯_(ツ)_/¯

@zbraniecki
Copy link

@zbraniecki zbraniecki commented May 17, 2017

I hit it on reddit.com. Also seems like it's the same as #13499

@mateon1
Copy link
Contributor

@mateon1 mateon1 commented Oct 7, 2017

Minimal crashing testcase, found with domato:

<script>
document.elementFromPoint(2,0).setAttribute("hidden","");
</script>
@jdm
Copy link
Member

@jdm jdm commented Mar 23, 2019

Sadly that testcase no longer makes Servo panic.

@mateon1
Copy link
Contributor

@mateon1 mateon1 commented Mar 25, 2019

@jdm Here's an example that reproduces on current servo:

<script>
function jsfuzzer() {
try { /* newvar{var00107:Element} */ var var00107 = document.elementFromPoint(22,0); } catch(e) { }
try { window.scrollTo(0.00320673159955,0.795496244014); } catch(e) { }
try { var00107.setAttribute("hidden", "hidden"); } catch(e) { }
}
</script>
<body onload=jsfuzzer()>

The scrollTo seems necessary now to reproduce this bug, but those specific values are just random.
I haven't fully reduced the example, hence the unnecessary try{}catch{}.

Debug backtrace
VMware, Inc.
llvmpipe (LLVM 7.0, 256 bits)
3.3 (Core Profile) Mesa 18.3.4
assertion failed: !self.Document().needs_reflow() ||
    (!for_display && self.Document().needs_paint()) ||
    self.suppress_reflow.get() (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(1), index: PipelineIndex(1) }, at components/script/dom/window.rs:1511)                                                                     
stack backtrace:
   0:     0x55d047c81ed6 - backtrace::backtrace::libunwind::trace::h8af3b710f1a5e12e
                        at /home/mateon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/libunwind.rs:53                                                                                                          
                         - backtrace::backtrace::trace::h2a1223234ae0346f
                        at /home/mateon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/mod.rs:42                                                                                                                
   1:     0x55d047c7c4e3 - backtrace::capture::Backtrace::new_unresolved::h2dd57ce7b77a7435
                        at /home/mateon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:88                                                                                                                      
   2:     0x55d047c7c43d - backtrace::capture::Backtrace::new::h8c6b161078e28d12
                        at /home/mateon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:63                                                                                                                      
   3:     0x55d040c34351 - servo::main::{{closure}}::h5fe9a894213f10e8
                        at ports/servo/non_android_main.rs:110
   4:     0x55d049d6fa48 - rust_panic_with_hook
                        at src/libstd/panicking.rs:482
   5:     0x55d047cee467 - std::panicking::begin_panic::hd447f23770529d66
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/panicking.rs:412
   6:     0x55d043edadc8 - script::dom::window::Window::reflow::h623765f4bba58379
                        at components/script/dom/window.rs:1511
   7:     0x55d043f5e249 - script::dom::document::Document::maybe_queue_document_completion::{{closure}}::h9e87a456d6dcd046                                                                                                                    
                        at components/script/dom/document.rs:1972
   8:     0x55d043069e24 - core::ops::function::FnOnce::call_once::hc16b9b88d40eef7b
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libcore/ops/function.rs:231
   9:     0x55d043f5dc9b - <script::dom::document::Document::maybe_queue_document_completion::fire_load_event<F> as script::task::TaskOnce>::run_once::h36f0c7f9379636ba                                                                       
                        at components/script/task.rs:24
  10:     0x55d04285df84 - <script::task::CancellableTask<T> as script::task::TaskOnce>::run_once::he28e36dcb4633419
                        at components/script/task.rs:122
  11:     0x55d042851b9c - <T as script::task::TaskBox>::run_box::h5753341af730489d
                        at components/script/task.rs:64
  12:     0x55d0426ad556 - script::script_thread::ScriptThread::handle_msg_from_script::h15d002ec5aef5d9d
                        at components/script/script_thread.rs:1745
  13:     0x55d042280579 - script::script_thread::ScriptThread::handle_msgs::{{closure}}::h9f46a3c0a7bb7f95
                        at components/script/script_thread.rs:1348
  14:     0x55d04228365e - script::script_thread::ScriptThread::profile_event::he7baa525ee50e51f
                        at components/script/script_thread.rs:1583
  15:     0x55d0426a884e - script::script_thread::ScriptThread::handle_msgs::hd718a0404a74804d
                        at components/script/script_thread.rs:1341
  16:     0x55d0426a5957 - script::script_thread::ScriptThread::start::h9d2b2f4b40ef17fd
                        at components/script/script_thread.rs:1178
  17:     0x55d04227cd51 - <script::script_thread::ScriptThread as script_traits::ScriptThreadFactory>::create::{{closure}}::{{closure}}::h3d2e50a51a59531c                                                                                    
                        at components/script/script_thread.rs:731
  18:     0x55d0439a2298 - profile_traits::mem::ProfilerChan::run_with_memory_reporting::h9a6fb4b77584b283
                        at /shared/dev/rust/servo/components/profile_traits/mem.rs:88
  19:     0x55d04227d4ed - <script::script_thread::ScriptThread as script_traits::ScriptThreadFactory>::create::{{closure}}::hec71b1d6b339dd35                                                                                                 
                        at components/script/script_thread.rs:729
  20:     0x55d0445007f4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h70010f71bf1d628c
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/sys_common/backtrace.rs:136
  21:     0x55d043457503 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::hea3251b085d70f10
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/thread/mod.rs:469
  22:     0x55d04391efd3 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hbd8938e17c48a216                                                                                                                  
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/panic.rs:309
  23:     0x55d043bcda49 - std::panicking::try::do_call::hd59da0280ee94513
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/panicking.rs:297
  24:     0x55d049d7a5f9 - __rust_maybe_catch_panic
                        at src/libpanic_unwind/lib.rs:87
  25:     0x55d043a9fa9f - std::panicking::try::h96247a5f4e51c63e
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/panicking.rs:276
  26:     0x55d04396fcd5 - std::panic::catch_unwind::hc4559b7cad69ef45
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/panic.rs:388
  27:     0x55d04345508f - std::thread::Builder::spawn_unchecked::{{closure}}::h66879e6d1707cb6d
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/libstd/thread/mod.rs:468
  28:     0x55d0434581f8 - <F as alloc::boxed::FnBox<A>>::call_box::h87e072e6468861a9
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/liballoc/boxed.rs:749
  29:     0x55d049d7993d - call_once<(),()>
                        at /rustc/0ea22717a1e01fa535534b85a5347a7e49fc79de/src/liballoc/boxed.rs:759
                         - start_thread
                        at src/libstd/sys_common/thread.rs:14
                         - thread_start
                        at src/libstd/sys/unix/thread.rs:80
  30:     0x7f48689effa2 - start_thread
  31:     0x7f486890482e - clone
  32:                0x0 - <unknown>
[2019-03-25T06:34:51Z ERROR servo] assertion failed: !self.Document().needs_reflow() ||
    (!for_display && self.Document().needs_paint()) ||
    self.suppress_reflow.get()
Pipeline failed in hard-fail mode.  Crashing!
@dralley
Copy link
Contributor

@dralley dralley commented Apr 4, 2020

I added some printlns to the logic around the assertion. Here's the code:

pub fn reflow(&self, reflow_goal: ReflowGoal, reason: ReflowReason) -> bool {
        self.Document().ensure_safe_to_run_script_or_layout();
        let for_display = reflow_goal == ReflowGoal::Full;

        let mut issued_reflow = false;
        let condition = self.Document().needs_reflow();
        if !for_display || condition.is_some() {
            issued_reflow = self.force_reflow(reflow_goal, reason, condition);

            // We shouldn't need a reflow immediately after a
            // reflow, except if we're waiting for a deferred paint.
            assert!({
                let condition = self.Document().needs_reflow();
                condition.is_none() ||
                    (!for_display && condition == Some(ReflowTriggerCondition::PaintPostponed)) ||
                    self.suppress_reflow.get()
            });
        }
    /// snip, irrelevant

And here are the state that causes the failing assertion:

  • On the second check, self.Document().needs_reflow() returns Some(PaintPostponed) (1st check = false)
  • !for_display== false (2nd check = false)
  • suppress_reflow is false (3rd check = false)
@dralley
Copy link
Contributor

@dralley dralley commented Apr 4, 2020

Slightly simpler reproducer, actual values aren't necessary nor are the try catch. This was already mentioned but, just confirming.

<script>
    function jsfuzzer() {
        var testvar = document.elementFromPoint(0, 0);
        window.scrollTo(0.0, 0.0);
        testvar.setAttribute("hidden", "hidden");
    }
</script>

<body onload=jsfuzzer()>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.