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

ScriptTask channel send failure when closing a page containing an iframe #2122

Closed
jdm opened this issue Apr 15, 2014 · 3 comments
Closed

ScriptTask channel send failure when closing a page containing an iframe #2122

jdm opened this issue Apr 15, 2014 · 3 comments
Labels

Comments

@jdm
Copy link
Member

@jdm jdm commented Apr 15, 2014

task 'ScriptTask' failed at 'sending on a closed channel', /home/jdm/sdb/servo/src/compiler/rust/src/libstd/comm/mod.rs:367
[Switching to Thread 0x7ffff7d5a700 (LWP 10287)]

Breakpoint 1, 0x00000000010d75c0 in rust_fail ()
Missing separate debuginfos, use: debuginfo-install libpciaccess-0.13.1-2.fc18.x86_64 libtxc_dxtn-1.0.0-2.fc17.x86_64 mesa-dri-drivers-9.2-0.12.20130610.fc18.x86_64
(gdb) bt
#0  0x00000000010d75c0 in rust_fail ()
#1  0x00000000010d7593 in rt::unwind::Unwinder::begin_unwind::h7020357fb8f0f7c6K4a::v0.10.pre ()
#2  0x000000000103e1ca in rt::unwind::begin_unwind_inner::h1ab4329e67a1c8afWfb::v0.10.pre ()
#3  0x000000000072ee63 in rt::unwind::begin_unwind::h35e1435a7a3641e6Ish::v0.1 ()
#4  0x00000000009d9877 in comm::Sender$LT$T$GT$::send::ha56392a4c22569d4c2n::v0.1 () at /home/jdm/sdb/servo/src/components/script/script_task.rs:343
#5  0x0000000000a452da in script::dom::node::Node::reap_layout_data (self=0x7ffff0013480) at /home/jdm/sdb/servo/src/components/script/dom/node.rs:812
#6  0x00000000007a40ca in script::dom::node::Node.Drop::drop (self=0x7ffff0013480) at /home/jdm/sdb/servo/src/components/script/dom/node.rs:127
#7  0x00000000007a4040 in dom..node..Node::glue_drop.42471::hbbca5e15bc8c928d () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/CharacterDataBinding.rs:464
#8  0x000000000080c2b6 in dom..element..Element::glue_drop.44313::h37647b8ca7f678a6 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/ElementBinding.rs:872
#9  0x0000000000823f8e in dom..htmlelement..HTMLElement::glue_drop.44566::h231eb3244c101e72 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/HTMLAnchorElementBinding.rs:806
#10 0x00000000008873be in dom..htmlhtmlelement..HTMLHtmlElement::glue_drop.45630::h25e3b222486da392 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/HTMLHtmlElementBinding.rs:206
#11 0x000000000088737c in _$UP$dom..htmlhtmlelement..HTMLHtmlElement::glue_drop.45627::h55e37b32f6aff055 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/HTMLHtmlElementBinding.rs:206
#12 0x0000000000887137 in script::dom::bindings::codegen::BindingDeclarations::HTMLHtmlElementBinding::_finalize (fop=0x7ffff4b4e7b0, obj=0x7fffd7a523a0)
    at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/HTMLHtmlElementBinding.rs:206
#13 0x0000000000887072 in dom::bindings::codegen::BindingDeclarations::HTMLHtmlElementBinding::_finalize::h774fdb153059aeb1HkX::v0.1 ()
    at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/HTMLHtmlElementBinding.rs:191
#14 0x00000000012daf40 in finalize (this=0x7fffd7a523a0 [Object HTMLHtmlElement], fop=0x7ffff4b4e7b0) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsobjinlines.h:235
#15 finalize<JSObject> (thingSize=48, thingKind=js::gc::FINALIZE_OBJECT2, fop=0x7ffff4b4e7b0, this=0x7fffd7a52000) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:348
#16 FinalizeTypedArenas<JSObject> (dest=..., budget=..., thingKind=js::gc::FINALIZE_OBJECT2, src=0x7ffff4b4e738, fop=0x7ffff4b4e7b0) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:412
#17 js::gc::FinalizeArenas (fop=fop@entry=0x7ffff4b4e7b0, src=src@entry=0x7ffff4b4e738, dest=..., thingKind=thingKind@entry=js::gc::FINALIZE_OBJECT2, budget=...)
    at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:449
#18 0x00000000012dbd56 in finalizeNow (thingKind=js::gc::FINALIZE_OBJECT2, fop=0x7ffff4b4e7b0, this=0x7fffd0002198) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:1627
#19 js::gc::ArenaLists::queueObjectsForSweep (this=0x7fffd0002198, fop=fop@entry=0x7ffff4b4e7b0) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:1723
#20 0x00000000012dce2c in BeginSweepPhase (rt=rt@entry=0x7ffff491b010) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:3752
#21 0x00000000012ddfbe in IncrementalCollectSlice (rt=rt@entry=0x7ffff491b010, budget=budget@entry=0, reason=js::gcreason::LAST_CONTEXT, gckind=js::GC_NORMAL)
    at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:4216
#22 0x00000000012df554 in GCCycle (rt=rt@entry=0x7ffff491b010, incremental=incremental@entry=false, budget=budget@entry=0, gckind=gckind@entry=js::GC_NORMAL, reason=reason@entry=js::gcreason::LAST_CONTEXT)
    at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:4394
#23 0x00000000012df941 in Collect (rt=0x7ffff491b010, incremental=false, budget=0, gckind=js::GC_NORMAL, reason=js::gcreason::LAST_CONTEXT)
    at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jsgc.cpp:4506
#24 0x00000000012a4474 in js::DestroyContext (cx=0x7fffe8016760, mode=<optimized out>) at /home/jdm/sdb/servo/src/support/spidermonkey/mozjs/js/src/jscntxt.cpp:394
#25 0x0000000000b9bd45 in js::rust::Cx.Drop::drop (self=0x7ffff4b4eaf8) at /home/jdm/sdb/servo/src/support/spidermonkey/rust-mozjs/rust.rs:96
#26 0x000000000094ea32 in js..rust..Cx::glue_drop.47562::hf4bd5e80986025b7 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/LocationBinding.rs:739
#27 0x000000000094e733 in rc::Rc$LT$T$GT$.Drop::drop::h83a424922cba79afYLm::v0.1 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/LocationBinding.rs:739
#28 0x000000000094e5fe in std..rc..Rc$LT$js..rust..Cx$GT$::glue_drop.47559::h40ea702a27259ed9 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/LocationBinding.rs:739
#29 0x000000000094e146 in script_task..JSPageInfo::glue_drop.47544::ha0e2a94828836bf7 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/LocationBinding.rs:739
#30 0x000000000094e0e6 in std..option..Option$LT$script_task..JSPageInfo$GT$::glue_drop.47541::h3c1ecc79c89f60c7 () at /home/jdm/sdb/servo/src/components/script/dom/bindings/codegen/LocationBinding.rs:739
#31 0x0000000000b697d1 in script::script_task::shut_down_layout (page=0x7fffe80161a0) at /home/jdm/sdb/servo/src/components/script/script_task.rs:1156
#32 0x0000000000b617d1 in script::script_task::ScriptTask::handle_exit_pipeline_msg (self=0x7fffe8016420, id=...) at /home/jdm/sdb/servo/src/components/script/script_task.rs:743
#33 0x0000000000b51f47 in script::script_task::ScriptTask::handle_msgs (self=0x7fffe8016420) at /home/jdm/sdb/servo/src/components/script/script_task.rs:627
#34 0x0000000000b50fc2 in script::script_task::ScriptTask::start (self=0x7fffe8016420) at /home/jdm/sdb/servo/src/components/script/script_task.rs:533
#35 0x0000000000584ad6 in script_task::ScriptTask::create::closure.26156 ()
#36 0x0000000000bb9368 in task::bootstrap_green_task::closure.7058 ()
#37 0x00000000010d3283 in rt::task::Task::run::closure.40680 ()
#38 0x00000000010de18c in rust_try ()
#39 0x00000000010d30e2 in rt::task::Task::run::h122390209273cc84148::v0.10.pre ()
#40 0x0000000000bb921a in task::bootstrap_green_task::hb22836aa95f14942Z5b::v0.10.pre ()
#41 0x0000000000000000 in ?? ()
@jdm jdm added the A-content/dom label Apr 15, 2014
@jdm
Copy link
Member Author

@jdm jdm commented Apr 15, 2014

We're trying to send the node to the layout task, but it apparently doesn't exist. That's a problem.

@jdm
Copy link
Member Author

@jdm jdm commented Apr 16, 2014

This occurs in shut_down_layout. My guess is that we don't end up triggering a GC for the first page we see while iterating, then we shut down its layout task and move on to the next. This triggers the final shutdown of SM which frees everything, including the nodes for the page that was previously shutdown. We should look into explicitly calling JS_GC before sending the final shutdown message to the layout task.

bors-servo pushed a commit that referenced this issue Nov 14, 2014
…ntDocument, r=jdm

Because of #2122 I cannot write test for this right now because it will be failing randomly due to that iframe issue. However, if it doesn't fail due to that issue a test like this:

```html
<html>
  <head>
    <meta charset="utf8" />
    <script src="harness.js"></script>
    <title>Iframe contentDocument test.</title>
  </head>
  <body>
    <iframe src="test_iframe_contentDocument_inner.html" id="iframe"></iframe>
    <script>
      waitForExplicitFinish();

      var timeout = 100;
      var iframe = document.getElementById('iframe');
      function test_contentWindow() {
        if (!iframe.contentWindow) {
          // Iframe not loaded yet, try again.
          // No load event for iframe, insert bug number here.
          setTimeout(test_contentWindow, timeout);
          return;
        }
        is(iframe.contentDocument.getElementById('test').textContent, 'value');
        finish();
      }
      test_contentWindow();
    </script>
  </body>
</html>
```
where inner is simply:
```html
<html><body><div id="test">value</div></body></html>
```
passes.

I have added `SameOrigin` method to the `UrlHelper`. I wanted to reuse it in [`constellation.rs` same_script check](https://github.com/servo/servo/blob/f0184a2d011e12845258a242d2d2f6b8b504a28d/components/compositing/constellation.rs#L625) but I it didn't want to compile saying

```
error: unresolved import `dom::urlhelper::UrlHelper`. Maybe a missing `extern crate dom`?
```

So I didn't include it in this PR for now.

There is more discussion about the cross origin iframes in [another issue](#3939). In this PR I just added same origin check.
bors-servo pushed a commit that referenced this issue Nov 14, 2014
…ntDocument, r=jdm

Because of #2122 I cannot write test for this right now because it will be failing randomly due to that iframe issue. However, if it doesn't fail due to that issue a test like this:

```html
<html>
  <head>
    <meta charset="utf8" />
    <script src="harness.js"></script>
    <title>Iframe contentDocument test.</title>
  </head>
  <body>
    <iframe src="test_iframe_contentDocument_inner.html" id="iframe"></iframe>
    <script>
      waitForExplicitFinish();

      var timeout = 100;
      var iframe = document.getElementById('iframe');
      function test_contentWindow() {
        if (!iframe.contentWindow) {
          // Iframe not loaded yet, try again.
          // No load event for iframe, insert bug number here.
          setTimeout(test_contentWindow, timeout);
          return;
        }
        is(iframe.contentDocument.getElementById('test').textContent, 'value');
        finish();
      }
      test_contentWindow();
    </script>
  </body>
</html>
```
where inner is simply:
```html
<html><body><div id="test">value</div></body></html>
```
passes.

I have added `SameOrigin` method to the `UrlHelper`. I wanted to reuse it in [`constellation.rs` same_script check](https://github.com/servo/servo/blob/f0184a2d011e12845258a242d2d2f6b8b504a28d/components/compositing/constellation.rs#L625) but I it didn't want to compile saying

```
error: unresolved import `dom::urlhelper::UrlHelper`. Maybe a missing `extern crate dom`?
```

So I didn't include it in this PR for now.

There is more discussion about the cross origin iframes in [another issue](#3939). In this PR I just added same origin check.
@nox
Copy link
Member

@nox nox commented Sep 1, 2015

Doesn't seem true anymore.

@nox nox closed this Sep 1, 2015
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
2 participants
You can’t perform that action at this time.