potocpav / xi_glium

Glium-based front-end to the xi editor
MIT License
84 stars 13 forks source link

panicked at 'Could not parse the core output: {"error": "return value missing", "id": 2}' #13

Closed little-dude closed 7 years ago

little-dude commented 7 years ago

Hi,

I'm seeing the following panick when running xi_glium:

~/r/xi_glium ❯❯❯ touch foo.txt
~/r/xi_glium ❯❯❯ target/debug/xi_glium foo.txt
res: "0"
thread '<unnamed>' panicked at 'Could not parse the core output: {"error": "return value missing", "id": 2}', src/core.rs:56
stack backtrace:
   1:     0x55a315ed6203 - std::sys::backtrace::tracing::imp::write::h46f28e67d38b4637
   2:     0x55a315edcf3d - std::panicking::default_hook::{{closure}}::h1d3243f546573ff4
   3:     0x55a315edc1c0 - std::panicking::default_hook::h96c288d728df3ebf
   4:     0x55a315edc7c8 - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
   5:     0x55a315edc662 - std::panicking::begin_panic::hfbeda5aad583dc32
   6:     0x55a315edc5a0 - std::panicking::begin_panic_fmt::h4fe9fb9d5109c4bf
   7:     0x55a315bf919f - xi_glium::core::Core::new::{{closure}}::h5d65e7c29a4ecf10
                        at /home/corentih/rust/xi_glium/src/core.rs:56
   8:     0x55a315bdf9da - <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once::h978e6a1deda42a28
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panic.rs:255
   9:     0x55a315b24f57 - std::panicking::try::do_call::h5beeded01bed2a19
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:326
  10:     0x55a315ee4a06 - __rust_maybe_catch_panic
  11:     0x55a315b246b6 - std::panicking::try::h466f5fab981af79e
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:302
  12:     0x55a315b222de - std::panic::catch_unwind::he83c3bd0cfdbbf31
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panic.rs:311
  13:     0x55a315bf6be8 - std::thread::Builder::spawn::{{closure}}::h91d1f6ae735451a6
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:282
  14:     0x55a315b7b5de - <F as alloc::boxed::FnBox<A>>::call_box::h748813ecf450e50e
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/liballoc/boxed.rs:590
  15:     0x55a315edafe0 - std::sys::thread::Thread::new::thread_start::h5b631f48cd23f128
  16:     0x7f0f4bc58453 - start_thread
  17:     0x7f0f4b7847de - __GI___clone
  18:                0x0 - <unknown>

This is with the current HEAD of xi-edit. I know that the README says that xi_glium works with https://github.com/google/xi-editor/commit/7f7b88590d413dc4531bf1d1f57f6dfcb0117966 but it's a pretty old commit already and xi-editor does not build with my current rust version.

Rust version: rustc 1.13.0-nightly (2c01bb885 2016-08-31)

Is this an issue with xi-editor itself, with xi_glium?

little-dude commented 7 years ago

I submitted an issue on the xi-editor repo, since I don't understand the error returned by the core.

Not completely related to this issue, but I'd like to use https://github.com/potocpav/xi_glium/blob/master/src/core.rs, would you consider putting it in a crate? For now I just copy/pasted it to play with it.

potocpav commented 7 years ago

I will have time to look into the issue on Monday.

There are many issues with the current approach (glium + glium_text), so I might end up switching to a different library for the GUI. Splitting off the core is a logical middle-step. Since there is now interest in that, I will probably just do it on Monday too.

potocpav commented 7 years ago

I'm sorry I'm late. Fixed the issue, it was caused by calling the back-end with an "id" parameter, when none is expected. The back-end returned an error which the front-end didn't know how to parse, so it crashed.

I split the fn call into fn notify and fn request to generate the "id" only when needed.

About making a library from core.rs; that will require quite a bit of refactoring, so I will not do it as a part of this issue.

little-dude commented 7 years ago

Thank you!

About making a library from core.rs; that will require quite a bit of refactoring, so I will not do it as a part of this issue.

That's ok for now I'm just copying the file in my workspace. What kind of refactoring are you thinking about? Maybe i can help.

potocpav commented 7 years ago

What I had in mind: get rid of unwraps, document public functions, possibly have options for debug output / backtrace of the xi-editor. If you are enthusiastic, you can just create your own project and do it as you wish :-)