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

Thread panicked while panicking #1

Closed
Grinshpon opened this issue Jan 13, 2021 · 1 comment
Closed

Thread panicked while panicking #1

Grinshpon opened this issue Jan 13, 2021 · 1 comment

Comments

@Grinshpon
Copy link
Owner

Grinshpon commented Jan 13, 2021

If there is an error in the gamelisp script, chances are the whole program will panic, and then panic while panicking. I'm not totally sure why this happens yet.

It occurs while printing out a stack trace. Example:

unhandled error in run() call:

stack trace:
    glsp::call(), invoking (glhf:draw)
    (new-circle) at main.glsp:11

error: expected a [T; 2], received an array of length 3
thread 'main' panicked at 'no glsp runtime is active; consider calling Runtime::run()', C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\engine.rs:111:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'no glsp runtime is active; consider calling Runtime::run()', C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\engine.rs:111:21
stack backtrace:
   0:     0x7ff734c7f3a5 - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff734c7f3a5 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff734c7f3a5 - std::sys_common::backtrace::_print_fmt
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff734c7f3a5 - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff734c97d8b - core::fmt::write
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\core\src\fmt\mod.rs:1078
   5:     0x7ff734c7b4cd - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\io\mod.rs:1518
   6:     0x7ff734c8222d - std::sys_common::backtrace::_print
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff734c8222d - std::sys_common::backtrace::print
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff734c8222d - std::panicking::default_hook::{{closure}}
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:208
   9:     0x7ff734c81d33 - std::panicking::default_hook
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:225
  10:     0x7ff734c82b6e - std::panicking::rust_panic_with_hook
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:591
  11:     0x7ff73445ff91 - std::panicking::begin_panic::{{closure}}<str>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\panicking.rs:520
  12:     0x7ff73445fd5f - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff73445fec7 - std::panicking::begin_panic<str>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\panicking.rs:519
  14:     0x7ff7345fa785 - glsp_engine::engine::with_heap::{{closure}}<tuple<>,closure-0>
                               at C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\engine.rs:111
  15:     0x7ff734672a05 - std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>>::try_with<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>,closure-0,tuple<>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\thread\local.rs:272
  16:     0x7ff73466c4a3 - std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>>::with<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>,closure-0,tuple<>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\thread\local.rs:248
  17:     0x7ff7345f2ed2 - glsp_engine::engine::with_heap<tuple<>,closure-0>
                               at C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\engine.rs:107
  18:     0x7ff73450010d - glsp_engine::gc::{{impl}}::drop<glsp_engine::code::GFn>
                               at C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\gc.rs:596
  19:     0x7ff7344083bf - core::ptr::drop_in_place<glsp_engine::gc::Root<glsp_engine::code::GFn>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  20:     0x7ff7343ff205 - core::ptr::drop_in_place<core::option::Option<glsp_engine::gc::Root<glsp_engine::code::GFn>>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  21:     0x7ff73404243e - core::ptr::drop_in_place<glhf::state::Callbacks>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  22:     0x7ff9c1461030 - <unknown>
  23:     0x7ff9c1464a52 - is_exception_typeof
  24:     0x7ff9c146e774 - _C_specific_handler
  25:     0x7ff9c1463cc8 - is_exception_typeof
  26:     0x7ff9c146f0a1 - _CxxFrameHandler3
  27:     0x7ff9d15018cf - _chkstk
  28:     0x7ff9d147d9b2 - RtlUnwindEx
  29:     0x7ff9c146ec32 - _C_specific_handler
  30:     0x7ff9c1462955 - is_exception_typeof
  31:     0x7ff9c1462d81 - is_exception_typeof
  32:     0x7ff9c1463dc4 - is_exception_typeof
  33:     0x7ff9c146f0a1 - _CxxFrameHandler3
  34:     0x7ff9d150184f - _chkstk
  35:     0x7ff9d14ca889 - RtlRaiseException
  36:     0x7ff9d14ca643 - RtlRaiseException
  37:     0x7ff9cee73b29 - RaiseException
  38:     0x7ff9c1466210 - CxxThrowException
  39:     0x7ff734c89611 - panic_unwind::real_imp::panic
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\panic_unwind\src\seh.rs:315
  40:     0x7ff734c89599 - panic_unwind::__rust_start_panic
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\panic_unwind\src\lib.rs:110
  41:     0x7ff734c82d68 - std::panicking::rust_panic
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:640
  42:     0x7ff734c82c04 - std::panicking::rust_panic_with_hook
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:610
  43:     0x7ff73445ff91 - std::panicking::begin_panic::{{closure}}<str>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\panicking.rs:520
  44:     0x7ff73445fd5f - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\sys_common\backtrace.rs:141
  45:     0x7ff73445fec7 - std::panicking::begin_panic<str>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\panicking.rs:519
  46:     0x7ff7345fa785 - glsp_engine::engine::with_heap::{{closure}}<tuple<>,closure-0>
                               at C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\engine.rs:111
  47:     0x7ff734672a05 - std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>>::try_with<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>,closure-0,tuple<>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\thread\local.rs:272
  48:     0x7ff73466c4a3 - std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>>::with<core::cell::RefCell<core::option::Option<alloc::rc::Rc<glsp_engine::engine::EngineStorage>>>,closure-0,tuple<>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\thread\local.rs:248
  49:     0x7ff7345f2ed2 - glsp_engine::engine::with_heap<tuple<>,closure-0>
                               at C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\engine.rs:107
  50:     0x7ff73450010d - glsp_engine::gc::{{impl}}::drop<glsp_engine::code::GFn>
                               at C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\glsp-engine-0.2.0\src\gc.rs:596
  51:     0x7ff7344083bf - core::ptr::drop_in_place<glsp_engine::gc::Root<glsp_engine::code::GFn>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  52:     0x7ff7343ff205 - core::ptr::drop_in_place<core::option::Option<glsp_engine::gc::Root<glsp_engine::code::GFn>>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  53:     0x7ff7340423bf - core::ptr::drop_in_place<glhf::state::Callbacks>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  54:     0x7ff7340433ce - core::ptr::drop_in_place<glhf::state::MainState>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ptr\mod.rs:179
  55:     0x7ff73403cda5 - glhf::main
                               at C:\Users\Daniel\Documents\Rust\glhf\src\main.rs:112
  56:     0x7ff7340420c3 - core::ops::function::FnOnce::call_once<fn() -> core::result::Result<tuple<>, glhf::error::GlhfError>,tuple<>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ops\function.rs:227
  57:     0x7ff7340563f6 - std::sys_common::backtrace::__rust_begin_short_backtrace<fn() -> core::result::Result<tuple<>, glhf::error::GlhfError>,core::result::Result<tuple<>, glhf::error::GlhfError>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\sys_common\backtrace.rs:125
  58:     0x7ff73403e316 - std::rt::lang_start::{{closure}}<core::result::Result<tuple<>, glhf::error::GlhfError>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\rt.rs:66
  59:     0x7ff734c82e64 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\core\src\ops\function.rs:280
  60:     0x7ff734c82e64 - std::panicking::try::do_call
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:379
  61:     0x7ff734c82e64 - std::panicking::try
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panicking.rs:343
  62:     0x7ff734c82e64 - std::panic::catch_unwind
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\panic.rs:396
  63:     0x7ff734c82e64 - std::rt::lang_start_internal
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\/library\std\src\rt.rs:51
  64:     0x7ff73403e2e3 - std::rt::lang_start<core::result::Result<tuple<>, glhf::error::GlhfError>>
                               at /rustc/6184f23950fb4aa14884ce310d948dc6fca269a3\library\std\src\rt.rs:65
  65:     0x7ff73403cfc0 - main
  66:     0x7ff734cbb6b4 - invoke_main
                               at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  67:     0x7ff734cbb6b4 - __scrt_common_main_seh
                               at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  68:     0x7ff9d0a27c24 - BaseThreadInitThunk
  69:     0x7ff9d14cd4d1 - RtlUserThreadStart
thread panicked while panicking. aborting.
error: process didn't exit successfully: `target\debug\glhf.exe` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)
@Grinshpon
Copy link
Owner Author

Turns out I needed the the closure in runtime.run to take ownership of the context, because it's an rglobal. At least I believe that's what the problem was, because changing runtime.run(| | { ... to runtime.run(move | | { ... stopped the panics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant