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

Crash trying to view http://slither.io/ #13879

Closed
lukehutch opened this issue Oct 21, 2016 · 5 comments
Closed

Crash trying to view http://slither.io/ #13879

lukehutch opened this issue Oct 21, 2016 · 5 comments
Assignees
Labels

Comments

@lukehutch
Copy link

@lukehutch lukehutch commented Oct 21, 2016

I tried the latest Servo nightly build on Fedora. When I go to http://slither.io/ , I get:

called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread CanvasThread, at ../src/libcore/result.rs:799)
called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread Constellation, at ../src/libcore/result.rs:799)
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }
called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread CanvasThread, at ../src/libcore/result.rs:799)
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }
called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread CanvasThread, at ../src/libcore/result.rs:799)
called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread CanvasThread, at ../src/libcore/result.rs:799)
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread CanvasThread, at ../src/libcore/result.rs:799)

ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }
called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } } (thread CanvasThread, at ../src/libcore/result.rs:799)
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 24, message: "Too many open files" } }
called `Result::unwrap()` on an `Err` value: IoError(Error { repr: Os { code: 104, message: "Connection reset by peer" } }) (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(1) }, at ../src/libcore/result.rs:799)
ERROR:servo: called `Result::unwrap()` on an `Err` value: IoError(Error { repr: Os { code: 104, message: "Connection reset by peer" } })
called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 104, message: "Connection reset by peer" } } (thread ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(1) }, at ../src/libcore/result.rs:799)
ERROR:servo: called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 104, message: "Connection reset by peer" } }
thread panicked while panicking. aborting.
Stack trace for thread "ScriptThread PipelineId { namespace_id: PipelineNamespaceId(0), index: PipelineIndex(1) }"
stack backtrace:
   0:     0x564defdcb22d - backtrace::backtrace::trace::h6ac07ced1b846a59
   1:     0x564defdcb8b2 - backtrace::capture::Backtrace::new::h1d3339ed08c7f861
   2:     0x564deea56084 - servo::install_crash_handler::handler::hbcbca0a8e3e6b31d
   3:     0x7f4fd768e76f - <unknown>
   4:     0x564df04b6440 - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   5:     0x564df04b6282 - std::panicking::begin_panic::hf6c488cee66e7f17
   6:     0x564df04b61c0 - std::panicking::begin_panic_fmt::hb0a7126ee57cdd27
   7:     0x564df04b6141 - rust_begin_unwind
   8:     0x564df04f295f - core::panicking::panic_fmt::h9af671b78898cdba
   9:     0x564def00f590 - core::result::unwrap_failed::h3ea0c9548cd89371
  10:     0x564def025884 - drop::h7183d462065227d2
  11:     0x564df04bea06 - __rust_maybe_catch_panic
  12:     0x564def36523f - script::dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DBinding::_finalize::hdef3933267ad4772
  13:     0x564def95373c - _ZNK2js5Class10doFinalizeEPNS_6FreeOpEP8JSObject
                        at /home/servo/buildbot/slave/linux-nightly/build/target/release/build/mozjs_sys-661d4efe7c7ca939/out/dist/include/js/Class.h:815
                         - 8JSObject8finalizeEPN2js6FreeOp
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsobjinlines.h:85
                         - _ZN2js2gc5Arena8finalizeI8JSObjectEEmPNS_6FreeOpENS0_9AllocKindEm
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:447
  14:     0x564def930eda - FinalizeTypedArenas<JSObject>
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:505
  15:     0x564def93307a - FinalizeArenas
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:539
  16:     0x564def933cb0 - 2js2gc10ArenaLists16forceFinalizeNowEPNS_6FreeOpENS0_9AllocKindENS1_14KeepArenasEnumEPPNS0_5Arena
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:2720
  17:     0x564def933de6 - 2js2gc10ArenaLists11finalizeNowEPNS_6FreeOpENS0_9AllocKindENS1_14KeepArenasEnumEPPNS0_5Arena
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:2702
                         - 2js2gc10ArenaLists30queueForegroundObjectsForSweepEPNS_6FreeOp
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:2839
  18:     0x564def93eb66 - 2js2gc9GCRuntime22beginSweepingZoneGroupERNS_26AutoLockForExclusiveAccess
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:5127
  19:     0x564def942ad3 - 2js2gc9GCRuntime15beginSweepPhaseEbRNS_26AutoLockForExclusiveAccess
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:5215
  20:     0x564def944766 - 2js2gc9GCRuntime23incrementalCollectSliceERNS_11SliceBudgetEN2JS8gcreason6ReasonERNS_26AutoLockForExclusiveAccess
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:5937
  21:     0x564def94543f - 2js2gc9GCRuntime7gcCycleEbRNS_11SliceBudgetEN2JS8gcreason6Reason
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:6174
  22:     0x564def945831 - 2js2gc9GCRuntime7collectEbNS_11SliceBudgetEN2JS8gcreason6Reason
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:6287
  23:     0x564def945b20 - 2js2gc9GCRuntime2gcE18JSGCInvocationKindN2JS8gcreason6Reason
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jsgc.cpp:6354
  24:     0x564defa648a5 - _ZN9JSRuntime14destroyRuntimeEv
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/vm/Runtime.cpp:430
  25:     0x564def8f954c - _ZN9JSContextD2Ev
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jscntxt.cpp:892
  26:     0x564def8f9b71 - js_delete_poison<JSContext>
                        at /home/servo/buildbot/slave/linux-nightly/build/target/release/build/mozjs_sys-661d4efe7c7ca939/out/dist/include/js/Utility.h:392
                         - _ZN2js14DestroyContextEP9JSContext
                        at /home/servo/.cargo/git/checkouts/mozjs-fa11ffc7d4f1cc2d/master/mozjs/js/src/jscntxt.cpp:133
  27:     0x564deee23861 - drop_contents::h00b5aac0381269ef
  28:     0x564deeee46fa - std::panicking::try::do_call::h61045ac6c938f9b9
  29:     0x564df04bea06 - __rust_maybe_catch_panic
  30:     0x564def044a44 - _<F as alloc..boxed..FnBox<A>>::call_box::h901e0ed8b85ec2e2
  31:     0x564df04b4a00 - std::sys::thread::Thread::new::thread_start::h50b05608a499d2b2
  32:     0x7f4fd7c3a5c9 - start_thread
  33:     0x7f4fd775cf6c - __clone
  34:                0x0 - <unknown>
Illegal instruction (core dumped)
@jdm
Copy link
Member

@jdm jdm commented Oct 21, 2016

Interesting. Looks like something's gotten worse since #10381 was reported.

@andrewguertin
Copy link
Contributor

@andrewguertin andrewguertin commented Jan 12, 2017

Seems like the game simply tries to create too many canvases. I reduced the page to the following testcase:

for (var i = 0; i < 2050; i++) {
  var cc = document.createElement("canvas");
  ctx = cc.getContext("2d");
}

The actual number of canvases the game creates seems to be around 2160, if I got my math right when editing its loops. The maximum I could create without crashing was around 2014, plus or minus a few as I edited my file.

@jdm
Copy link
Member

@jdm jdm commented Jan 12, 2017

It certainly doesn't help that Servo creates a thread per canvas.

@ameenross
Copy link

@ameenross ameenross commented Jan 12, 2017

Maybe this should be filed as a bug over at slither: "Slither so horribly inefficient that people so desperately fight lag that they try it in Servo"...

@jdm
Copy link
Member

@jdm jdm commented Jan 12, 2017

We should probably try a model of one thread shared for all canvases instead.

bors-servo added a commit that referenced this issue Apr 23, 2018
Moved Canvas rendering to a single thread.

<!-- Please describe your changes on the following line: -->

Implements the "Subsequent Steps" part of the [NCSU Canvas rendering project.](https://github.com/servo/servo/wiki/Canvas-rendering-project)

I moved most of the functionality from CanvasPaintThread to CanvasData, so CanvasPaintThread essentially just pulls the info out of the message and calls a method on a particular CanvasData element.

I ran into some awkwardness with the fact that one can only take a single mutable reference from a hashmap, though. DrawImageInOther is not really possible to do with only one reference at a time, so it awkwardly still lives in CanvasPaintThread, basically. I also would've preferred to take the reference at the top as soon as I get the CanvasId, since that looks cleaner than having them all start with "canvas_paint_thread.canvases.get_mut[&canvas_id].unwrap()" but that makes trying to take the second reference for DrawImageInOther fail to compile. I'm definitely open to suggestions on how to make that less gross.

The timed single-canvas drawing improved in performance from around ~2.2ms to around ~1.7ms. Slither.io runs better and doesn't crash, but I'm not having it crash on my copy from before these changes, so I don't know if that's new behavior or not.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13879 and #10381.

<!-- Either: -->
- [X] There are tests for these changes (added in the initial steps)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20680)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Apr 23, 2018
Moved Canvas rendering to a single thread.

<!-- Please describe your changes on the following line: -->

Implements the "Subsequent Steps" part of the [NCSU Canvas rendering project.](https://github.com/servo/servo/wiki/Canvas-rendering-project)

I moved most of the functionality from CanvasPaintThread to CanvasData, so CanvasPaintThread essentially just pulls the info out of the message and calls a method on a particular CanvasData element.

I ran into some awkwardness with the fact that one can only take a single mutable reference from a hashmap, though. DrawImageInOther is not really possible to do with only one reference at a time, so it awkwardly still lives in CanvasPaintThread, basically. I also would've preferred to take the reference at the top as soon as I get the CanvasId, since that looks cleaner than having them all start with "canvas_paint_thread.canvases.get_mut[&canvas_id].unwrap()" but that makes trying to take the second reference for DrawImageInOther fail to compile. I'm definitely open to suggestions on how to make that less gross.

The timed single-canvas drawing improved in performance from around ~2.2ms to around ~1.7ms. Slither.io runs better and doesn't crash, but I'm not having it crash on my copy from before these changes, so I don't know if that's new behavior or not.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13879 and #10381.

<!-- Either: -->
- [X] There are tests for these changes (added in the initial steps)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20680)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Apr 24, 2018
Moved Canvas rendering to a single thread.

<!-- Please describe your changes on the following line: -->

Implements the "Subsequent Steps" part of the [NCSU Canvas rendering project.](https://github.com/servo/servo/wiki/Canvas-rendering-project)

I moved most of the functionality from CanvasPaintThread to CanvasData, so CanvasPaintThread essentially just pulls the info out of the message and calls a method on a particular CanvasData element.

I ran into some awkwardness with the fact that one can only take a single mutable reference from a hashmap, though. DrawImageInOther is not really possible to do with only one reference at a time, so it awkwardly still lives in CanvasPaintThread, basically. I also would've preferred to take the reference at the top as soon as I get the CanvasId, since that looks cleaner than having them all start with "canvas_paint_thread.canvases.get_mut[&canvas_id].unwrap()" but that makes trying to take the second reference for DrawImageInOther fail to compile. I'm definitely open to suggestions on how to make that less gross.

The timed single-canvas drawing improved in performance from around ~2.2ms to around ~1.7ms. Slither.io runs better and doesn't crash, but I'm not having it crash on my copy from before these changes, so I don't know if that's new behavior or not.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach build-geckolib` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13879 and #10381.

<!-- Either: -->
- [X] There are tests for these changes (added in the initial steps)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20680)
<!-- Reviewable:end -->
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.

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