Skip to content

panic: Failed to get browsing context info from constellation.: Disconnected at components/script/script_thread.rs:2917 #36747

Closed

Description

@fred-wang

It seems there are several similar reports, but not sure whether they are duplicates.

Minimal testcase:

<!DOCTYPE html>
<style>
#form { border-image-source: url(database64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7); border-style: solid; }
</style>
<script>
  window.addEventListener("load", _ => {
    form.submit();
    window.frames.stop();
    iframe.src = "data:text/html,";
  });
</script>
<form id="form">
<iframe id="iframe"></iframe>

System: Linux
Version: Servo 0.0.1-107fd2546

Failed to get browsing context info from constellation.: Disconnected (thread Script(70,3), at components/script/script_thread.rs:2917)
   0: servoshell::backtrace::print
   1: servoshell::panic_hook::panic_hook
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::begin_panic_handler::{{closure}}
   4: std::sys::backtrace::__rust_end_short_backtrace
   5: rust_begin_unwind
   6: core::panicking::panic_fmt
   7: core::result::unwrap_failed
   8: script::script_thread::ScriptThread::remote_window_proxy
   9: script::script_thread::ScriptThread::local_window_proxy
  10: script::script_thread::ScriptThread::load
  11: <script::dom::servoparser::ParserContext as net_traits::FetchResponseListener>::process_response
  12: script::script_thread::ScriptThread::handle_msg_from_script
  13: script::script_thread::ScriptThread::handle_msgs::{{closure}}
  14: script::script_thread::ScriptThread::handle_msgs
  15: std::sys::backtrace::__rust_begin_short_backtrace
  16: core::ops::function::FnOnce::call_once{{vtable.shim}}
  17: std::sys::pal::unix::thread::Thread::new::thread_start
  18: start_thread
             at ./nptl/pthread_create.c:447:8
  19: clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0

Activity

  1. added
    C-untriaged
    on Apr 29, 2025
  2. changed the title [-]Panic: Failed to get browsing context info from constellation.: Disconnected at components/script/script_thread.rs:2917[/-] [+]panic: Failed to get browsing context info from constellation.: Disconnected at components/script/script_thread.rs:2917[/+] on Apr 29, 2025
  3. gterzian commented on May 1, 2025

    @gterzian
    Member

    Looks like it relates to #31973

    The error is due to a Disconnected error on result_receiver .recv() .expect("Failed to get browsing context info from constellation."), pointing towards the constellation having dropped the result_sender in the message before responding, so this is rather a sympton of the lack of clean shutdown investigated at #30849

  4. added
    A-constellation
    and removed
    C-untriaged
    on May 1, 2025
  5. added
    C-has-manual-testcase
    I-panic
    A-content/script
    on Jul 12, 2025
  6. gterzian commented on Aug 7, 2025

    @gterzian
    Member

    This seems to have been fixed now, probably by #38424 and #38322

    Confirmed locally on Mac.

    Can anybody try on Linux please?

  7. gterzian commented on Aug 13, 2025

    @gterzian
    Member

    I can't reproduce the crash, but I do get the load event repeated in a loop, which doesn't happen if I load the page in firefox.

  8. gterzian commented on Aug 13, 2025

    @gterzian
    Member

    Actually I can reproduce the crash, it is intermittent. We navigate the iframe and the main page in a loop, which seems wrong, and then if you try to close the browser, you get the crash sometimes.

  9. gterzian commented on Aug 14, 2025

    @gterzian
    Member

    Ok so the loop if because of the form submission on the main window, and the resulting navigation should actually be canceled by the call to window.frames.stop, but

    // TODO: Cancel ongoing navigation.

  10. gterzian commented on Aug 14, 2025

    @gterzian
    Member

    Also interesting to note we always end-up creating a new script-thread for each navigation, but those all point to the same webview, which seems wrong. Incidentally, it makes it hard to cancel the navigation, since it originates in one script-thread, but ends-up in a new one.

  11. gterzian commented on Aug 14, 2025

    @gterzian
    Member

    Ok so actually creating new script-threads sort of makes sense, because we also destroy the previous one.

    To stop the infinite navigation loop, we need to implement the cancelling of stop. There are two cases:

    • Intra script-thread navigation: the pipeline changes, but the browsing context stays the same. So we can set the ongoing-navigation on the browsing context, and cancel it locally. When the new layout info comes in, ignore it.
    • Inter script-thread navigation: we need to send a message to constellation, but the effect will be inherently racy, since the outcome of the navigation will happen in another newly created script-thread(also not sure how this makes sense with the browsing context).

    I think I'll try to find some simple first step to take in that direction, because the spec uses this navigable concept which we don't have yet, and to have it we'd need something to survive the navigation(so not the pipeline since it is closed and a new one is created), so a little like the browsing context, although it's not clear to me if we really re-use it, in particular when we end-up creating a new script-thread.

  12. added
    B-fuzzing
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-constellationA-content/scriptB-fuzzingC-has-manual-testcaseI-panic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions