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

called `Option::unwrap()` on a `None` value (Event::new_uninitialized) #12048

Closed
mnordine opened this issue Jul 1, 2016 · 7 comments
Closed

called `Option::unwrap()` on a `None` value (Event::new_uninitialized) #12048

mnordine opened this issue Jul 1, 2016 · 7 comments

Comments

@mnordine
Copy link

@mnordine mnordine commented Jul 1, 2016

called Option::unwrap() on a None value

URL:

https://features.wearemel.com/ill-retire-when-i-m-dead-why-continuing-to-work-is-good-for-a-man-s-health-c3053052d136?gi=47d56ab34b96

Backtrace:

frame #0  - 0x000000011086c6ce - backtrace::backtrace::trace::hccde8df28b4db2a2
frame #1  - 0x000000011086c651 - backtrace::capture::Backtrace::new::h42f95930bb8c5ee8
frame #2  - 0x000000010fb3d086 - _<F as alloc..boxed..FnBox<A>>::call_box::h6059122298f825d8
frame #3  - 0x00000001107e0947 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h2c0e77c593c00c08
frame #4  - 0x0000000110a54844 - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
frame #5  - 0x0000000110a6d786 - std::panicking::begin_panic::he426e15a3766089a
frame #6  - 0x0000000110a55e88 - std::panicking::begin_panic_fmt::hdddb415186c241e7
frame #7  - 0x0000000110a6d3df - rust_begin_unwind
frame #8  - 0x0000000110a94260 - core::panicking::panic_fmt::hf4e16cb7f0d41a25
frame #9  - 0x0000000110a9455c - core::panicking::panic::h907815f47e914305
frame #10 - 0x000000010f938895 - script::dom::event::Event::new_uninitialized::he3ccb94702598d61
frame #11 - 0x000000010f940aa7 - script::dom::event::Event::new::h115b505636eaa661
frame #12 - 0x000000010fa0d312 - script::dom::htmlscriptelement::HTMLScriptElement::dispatch_event::hfd4452ea712f8efd
frame #13 - 0x000000010f927241 - script::dom::htmlscriptelement::HTMLScriptElement::execute::hd6eb39d1b33b28da
frame #14 - 0x000000010f37580c - script::dom::document::Document::finish_load::h1ce7e49c25d85fc2
frame #15 - 0x000000010fa069b8 - _<script..dom..htmlscriptelement..ScriptContext as net_traits..AsyncResponseListener>::response_complete::h536287b80705375c
frame #16 - 0x000000010fa0c5c5 - _<script..network_listener..ListenerRunnable<A, Listener> as script..script_thread..Runnable>::handler::h213e3c65c1a0f2f0
frame #17 - 0x000000010fb4895c - script::script_thread::ScriptThread::handle_msg_from_script::hd1f5e7b2423a8c64
frame #18 - 0x000000010fba4a71 - script::script_thread::ScriptThread::handle_msgs::_$u7b$$u7b$closure$u7d$$u7d$::hc67d8b381c013b79
frame #19 - 0x000000010fb8a73f - script::script_thread::ScriptThread::handle_msgs::h236c5be60a207bea
frame #20 - 0x000000010fb3b907 - std::panicking::try::call::h645a328f039d97c6
frame #21 - 0x0000000110a7046b - __rust_try
frame #22 - 0x0000000110a70405 - __rust_maybe_catch_panic
frame #23 - 0x000000010fb3cab4 - _<F as alloc..boxed..FnBox<A>>::call_box::h3db95636eb747818
frame #24 - 0x0000000110a6bee8 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
frame #25 - 0x00007fff94f6f99c - _pthread_body
frame #26 - 0x00007fff94f6f919 - _pthread_start

@jdm jdm changed the title called `Option::unwrap()` on a `None` value called `Option::unwrap()` on a `None` value (Event::new_uninitialized) Jul 1, 2016
@jdm
Copy link
Member

@jdm jdm commented Jul 2, 2016

I hit #12081 while trying to reproduce this.

@jdm jdm added the C-reproduced label Jul 2, 2016
@jdm
Copy link
Member

@jdm jdm commented Jul 2, 2016

We have two instances of layout threads being shut down (removing iframes, perhaps?), and then a network response completing and a script attempting to execute in a script thread that was previously shut down.

@cbrewster
Copy link
Member

@cbrewster cbrewster commented Jul 5, 2016

More useful backtrace:

frame #0  - 0x0000000105b4a710 - backtrace::backtrace::trace::hccde8df28b4db2a2
frame #1  - 0x0000000105b4a5ba - backtrace::capture::Backtrace::new::h42f95930bb8c5ee8
frame #2  - 0x00000001037d5095 - util::thread::spawn_named_with_send_on_panic::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h8e08bac0ce5835b1
frame #3  - 0x00000001037d5690 - extern $u22$rust.call$u22$$u20$fn$LP$$u5b$closure$SP$DefId$u20$$u7b$$u20$krate.$u20$50$C$$u20$node.$u20$DefIndex$LP$2264$RP$$u20$$u7d$$u20$0.ipc_channel..ipc..IpcSender$LT$$LP$core..option..Option$LT$msg..constellation_msg..PipelineId$GT$$C$$u20$std..string..String$C$$u20$std..string..String$RP$$GT$$C$$u20$1.core..option..Option$LT$msg..constellation_msg..PipelineId$GT$$u5d$$C$$u20$$LP$$RF$core..any..Any$C$$RP$$RP$::once_shim.216715::h3190046b5fea3554
frame #4  - 0x00000001037d563c - _<F as alloc..boxed..FnBox<A>>::call_box::hebb3b95724d7c6a0
frame #5  - 0x0000000105accc8f - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::hddf831bcfa835e79
frame #6  - 0x0000000105acc893 - _<std..thread..local..LocalKey<T>>::with::h49e68c592f601e39
frame #7  - 0x0000000105acc6e6 - util::panicking::initiate_panic_hook::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h0fcde37d4d058867
frame #8  - 0x0000000105c63f14 - std::panicking::rust_panic_with_hook::h983af77c1a2e581b
frame #9  - 0x0000000105c7cf56 - std::panicking::begin_panic::he426e15a3766089a
frame #10 - 0x0000000105c65558 - std::panicking::begin_panic_fmt::hdddb415186c241e7
frame #11 - 0x0000000105c7cbaf - rust_begin_unwind
frame #12 - 0x0000000105ca3a30 - core::panicking::panic_fmt::hf4e16cb7f0d41a25
frame #13 - 0x0000000105ca3d2c - core::panicking::panic::h907815f47e914305
frame #14 - 0x00000001036da502 - _<core..option..Option<T>>::unwrap::ha9f039774ae8a5ee
frame #15 - 0x0000000102385b70 - script::dom::window::Window::get_cx::h924ad22f09592138
frame #16 - 0x0000000102328c9c - script::dom::bindings::global::GlobalRef::get_cx::h02f273e0685db6d7
frame #17 - 0x0000000103424c40 - script::dom::bindings::reflector::reflect_dom_object::h08182bdb4575a78f
frame #18 - 0x00000001033a3770 - script::dom::event::Event::new_uninitialized::h1c51fe88f444d2d8
frame #19 - 0x00000001033b67e7 - script::dom::event::Event::new::h8b5a22a0acccc5a2
frame #20 - 0x000000010352c68f - script::dom::htmlscriptelement::HTMLScriptElement::dispatch_event::h0c705ca3c8337fe0
frame #21 - 0x000000010352c1fc - script::dom::htmlscriptelement::HTMLScriptElement::dispatch_before_script_execute_event::hb105e55159c7345f
frame #22 - 0x00000001033763a5 - script::dom::htmlscriptelement::HTMLScriptElement::execute::h776378cb1575064b
frame #23 - 0x000000010337274a - script::dom::document::Document::maybe_execute_parser_blocking_script::hf7f77dbf7fa6dd12
frame #24 - 0x0000000102353ccb - script::dom::document::Document::finish_load::h13371ea3d4ab55e4
frame #25 - 0x0000000103523c84 - _<script..dom..htmlscriptelement..ScriptContext as net_traits..AsyncResponseListener>::response_complete::h8b6124ed78c481e9
frame #26 - 0x000000010352b5ad - _<net_traits..ResponseAction as net_traits..Action<T>>::process::hd6faeba416421ac2
frame #27 - 0x000000010352aada - _<script..network_listener..ListenerRunnable<A, Listener> as script..script_thread..Runnable>::handler::hf2abd4b95d493887
frame #28 - 0x00000001037ec6ac - script::script_thread::ScriptThread::handle_msg_from_script::h6a6b4ae37d32650d
frame #29 - 0x0000000103883988 - script::script_thread::ScriptThread::handle_msgs::_$u7b$$u7b$closure$u7d$$u7d$::hdfba591677ee0854
frame #30 - 0x00000001038834f5 - script::script_thread::ScriptThread::profile_event::h180ff2036b8c2783
frame #31 - 0x000000010385142d - script::script_thread::ScriptThread::handle_msgs::h45a47f1f1786f911
frame #32 - 0x00000001037e9dfc - script::script_thread::ScriptThread::start::hf0f02e16b9da3912
frame #33 - 0x00000001037e9dab - _<script..script_thread..ScriptThread as script_traits..ScriptThreadFactory>::create::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h60e2514d7c15aeaf
frame #34 - 0x00000001037e9b01 - profile_traits::mem::ProfilerChan::run_with_memory_reporting::h90164fdc02bc9ddf
frame #35 - 0x00000001037d5db6 - _<script..script_thread..ScriptThread as script_traits..ScriptThreadFactory>::create::_$u7b$$u7b$closure$u7d$$u7d$::hc2f6bfd107201055
frame #36 - 0x00000001037d444e - util::thread::spawn_named_with_send_on_panic::_$u7b$$u7b$closure$u7d$$u7d$::h44d46100d4f5f190
frame #37 - 0x00000001037d4207 - _<std..panic..AssertUnwindSafe<F> as core..ops..FnOnce<()>>::call_once::h4974dfb1034d8cd6
frame #38 - 0x00000001037d415b - std::panicking::try::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h4326e3cb5bf9d187
frame #39 - 0x00000001037d4a14 - std::panicking::try::call::h78061d8f9ce27ca7
frame #40 - 0x0000000105c7fc3b - __rust_try
frame #41 - 0x0000000105c7fbd5 - __rust_maybe_catch_panic
frame #42 - 0x00000001037d40ad - std::panicking::try::_$u7b$$u7b$closure$u7d$$u7d$::he258e52e28311769
frame #43 - 0x00000001037d3fff - _<std..thread..local..LocalKey<T>>::with::h6a07862be6a45706
frame #44 - 0x00000001037d3e2f - std::panicking::try::h90b38a4a00a80b43
frame #45 - 0x00000001037d3d0e - std::panic::catch_unwind::h066dae249590ffb5
frame #46 - 0x00000001037d3b6c - std::thread::Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::hb658a84aa2bff2ef
frame #47 - 0x00000001037d4c17 - _<F as alloc..boxed..FnBox<A>>::call_box::h2ec158fb92e41aca
frame #48 - 0x0000000105c7b6b8 - std::sys::thread::Thread::new::thread_start::h9c883b6d445ece46
frame #49 - 0x00007fff9b96f99c - _pthread_body
frame #50 - 0x00007fff9b96f919 - _pthread_start
@cbrewster
Copy link
Member

@cbrewster cbrewster commented Jul 5, 2016

@jdm in this scenario is there anyway to check if the script thread has been shut down before attempting to execute a script?

@jdm
Copy link
Member

@jdm jdm commented Jul 5, 2016

There's a mechanism for marking runnables as revocable based on the ignore_further_async_events member in Window (see the use of window.get_runnable_wrapper and wrap_runnable in htmlimageelement.rs). This probably requires making all the runnables created by NetworkListener revocable.

@jdm
Copy link
Member

@jdm jdm commented Jul 5, 2016

It's possible to write code to not execute script by adding an API to GlobalRef and calling it from evaluate_script_on_global_with_result; it's not really clear to me whether we would end up playing whack-a-mole with non-script related things if we added that restriction instead of the plan in the previous comment.

@cbrewster cbrewster added the C-assigned label Jul 5, 2016
@cbrewster cbrewster self-assigned this Jul 5, 2016
@cbrewster cbrewster mentioned this issue Jul 5, 2016
4 of 5 tasks complete
bors-servo added a commit that referenced this issue Jul 6, 2016
…r=<try>

Make network listener runnable cancellable

<!-- Please describe your changes on the following line: -->
This keeps scripts from executing after its script thread has been shut down.

---
<!-- 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 test-tidy` does not report any errors
- [x] These changes fix #12048 and fix #11703 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12277)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jul 6, 2016
…r=<try>

Make network listener runnable cancellable

<!-- Please describe your changes on the following line: -->
This keeps scripts from executing after its script thread has been shut down.

---
<!-- 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 test-tidy` does not report any errors
- [x] These changes fix #12048 and fix #11703 and fix #12284 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12277)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jul 8, 2016
…r=Manishearth

Make network listener runnable cancellable

<!-- Please describe your changes on the following line: -->
This keeps scripts from executing after its script thread has been shut down.

---
<!-- 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 test-tidy` does not report any errors
- [x] These changes fix (maybe) #12048 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12277)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jul 8, 2016
…r=Manishearth

Make network listener runnable cancellable

<!-- Please describe your changes on the following line: -->
This keeps scripts from executing after its script thread has been shut down.

---
<!-- 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 test-tidy` does not report any errors
- [x] These changes fix (maybe) #12048 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12277)
<!-- Reviewable:end -->
@cbrewster
Copy link
Member

@cbrewster cbrewster commented Jul 16, 2016

Fixed in #12277

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
3 participants
You can’t perform that action at this time.