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

Panic when pasting large text twice #1112

Closed
scholtzan opened this issue Feb 9, 2019 · 8 comments
Closed

Panic when pasting large text twice #1112

scholtzan opened this issue Feb 9, 2019 · 8 comments

Comments

@scholtzan
Copy link
Member

If I copy core-lib/view.rs and paste it twice then xi panics:

thread '<xi-syntect-plugin> core host thread' panicked at 'assertion failed: self.start >= amount', rope/src/interval.rs:135:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: xi_rope::interval::Interval::translate_neg
   7: xi_core_lib::linewrap::Lines::patchup_tasks
   8: xi_core_lib::linewrap::Lines::after_edit
   9: xi_core_lib::view::View::after_edit
  10: xi_core_lib::event_context::EventContext::update_views::{{closure}}
  11: core::iter::iterator::Iterator::for_each::{{closure}}
  12: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  13: core::iter::iterator::Iterator::fold::{{closure}}
  14: core::iter::iterator::Iterator::try_fold
  15: core::iter::iterator::Iterator::fold
  16: <core::iter::Chain<A, B> as core::iter::iterator::Iterator>::fold
  17: core::iter::iterator::Iterator::for_each
  18: xi_core_lib::event_context::EventContext::update_views
  19: xi_core_lib::event_context::EventContext::after_edit
  20: xi_core_lib::event_context::EventContext::do_plugin_cmd
  21: xi_core_lib::tabs::CoreState::plugin_notification
  22: <xi_core_lib::core::WeakXiCore as xi_rpc::Handler>::handle_notification
  23: <xi_rpc::RpcLoop<W>>::mainloop::{{closure}}
  24: crossbeam_utils::thread::scope::{{closure}}
  25: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  26: std::panicking::try::do_call
  27: __rust_maybe_catch_panic
  28: std::panicking::try
  29: std::panic::catch_unwind
  30: crossbeam_utils::thread::scope
  31: <xi_rpc::RpcLoop<W>>::mainloop
  32: xi_core_lib::plugins::start_plugin_process::{{closure}}
[2019-02-08][16:43:35][xi_rpc][ERROR] panic guard hit, closing runloop
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: <core::result::Result<T, E>>::unwrap
  10: xi_core_lib::core::XiCore::inner
  11: <xi_core_lib::core::XiCore as xi_rpc::Handler>::handle_notification
  12: <xi_rpc::RpcLoop<W>>::mainloop::{{closure}}
  13: crossbeam_utils::thread::scope::{{closure}}
  14: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  15: std::panicking::try::do_call
  16: __rust_maybe_catch_panic
  17: std::panicking::try
  18: std::panic::catch_unwind
  19: crossbeam_utils::thread::scope
  20: <xi_rpc::RpcLoop<W>>::mainloop
  21: xi_core::main
  22: std::rt::lang_start::{{closure}}
  23: std::panicking::try::do_call
  24: __rust_maybe_catch_panic
  25: std::rt::lang_start_internal
  26: std::rt::lang_start
  27: main

Not entirely sure what the problem is.

@cmyr
Copy link
Member

cmyr commented Feb 10, 2019

Interesting, haven't seen this before. The crash is in code I wrote in december, so I'll take a look.

@ritiek
Copy link

ritiek commented Mar 5, 2019

I am able to reproduce this on master only when syntect-plugin is enabled.

cmyr added a commit to cmyr/xi-editor that referenced this issue Mar 6, 2019
We were trying to preserve the entire task in a case where we
only should have been preserving the 'tail' of the task.

- Fixes xi-editor#1112
@cmyr cmyr mentioned this issue Mar 6, 2019
4 tasks
cmyr added a commit to cmyr/xi-editor that referenced this issue Mar 9, 2019
We were trying to preserve the entire task in a case where we
only should have been preserving the 'tail' of the task.

- Fixes xi-editor#1112
@sjoshid
Copy link
Contributor

sjoshid commented Mar 11, 2019

Im experiencing something similar. But it doesnt happen on copy-paste of large text. I have a file with ~110k lines. The file opens up with a lot, A LOT, of

stylemap can't resolve 8

errors and when I try to clear the file by doing ⌘ A and backspace I get similar stacktrace along with

waiting for lines: (21, 22)
semaphore timeout 31031us timedOut

Hope this is helpful in some way.

@cmyr
Copy link
Member

cmyr commented Mar 12, 2019

this should be fixed in #1129, if either of you want to try that?

cmyr added a commit that referenced this issue Mar 12, 2019
We were trying to preserve the entire task in a case where we
only should have been preserving the 'tail' of the task.

- Fixes #1112
@sjoshid
Copy link
Contributor

sjoshid commented Mar 14, 2019

I hate to be the one to say this but I still get errors

stylemap can't resolve 8 <-- thousands of line 
thread 'main' panicked at 'index 1845405 out of range for slice of length 1048576', libcore/slice/mod.rs:2334:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::slice::slice_index_len_fail
   9: <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index
  10: core::slice::<impl core::ops::index::Index<I> for [T]>::index
  11: xi_plugin_lib::base_cache::ChunkCache::simple_delete
  12: xi_plugin_lib::base_cache::ChunkCache::should_clear
  13: <xi_plugin_lib::base_cache::ChunkCache as xi_plugin_lib::Cache>::update
  14: <xi_plugin_lib::state_cache::StateCache<S> as xi_plugin_lib::Cache>::update
  15: <xi_plugin_lib::view::View<C>>::update
  16: <xi_plugin_lib::dispatch::Dispatcher<'a, P>>::do_update
  17: <xi_plugin_lib::dispatch::Dispatcher<'a, P> as xi_rpc::Handler>::handle_request
  18: <xi_rpc::RpcLoop<W>>::mainloop::{{closure}}
  19: crossbeam_utils::thread::scope::{{closure}}
  20: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  21: std::panicking::try::do_call
  22: __rust_maybe_catch_panic
  23: std::panicking::try
  24: std::panic::catch_unwind
  25: crossbeam_utils::thread::scope
  26: <xi_rpc::RpcLoop<W>>::mainloop
  27: xi_plugin_lib::mainloop
  28: xi_syntect_plugin::main
  29: std::rt::lang_start::{{closure}}
  30: std::panicking::try::do_call
  31: __rust_maybe_catch_panic
  32: std::rt::lang_start_internal
  33: std::rt::lang_start
  34: main
[2019-03-13][20:52:05][xi_core_lib::event_context][ERROR] plugin shutdown, do something PeerDisconnect
[2019-03-13][20:52:05][xi_core_lib::tabs][WARN] plugin PluginPid(1) exited with result Ok(())
client: plugin stopped xi-syntect-plugin
[2019-03-13][20:52:05][xi_core_lib::tabs][DEBUG] Event in open file NoticeRemove("/Users/sujitjoshi/notify/append")

But the good news is the UI doesn't crash anymore. I can keep using it like nothing happened.
Maybe we can ignore the error for now?

@scholtzan
Copy link
Member Author

scholtzan commented Mar 14, 2019

This looks like an issue with xi-syntect. It's probably worth opening a new issue for this.

@cmyr
Copy link
Member

cmyr commented Mar 14, 2019

@sjoshid I agree, this is a different crash. Can you open a new issue with reproduction steps?

@sjoshid
Copy link
Contributor

sjoshid commented Mar 15, 2019

Sure. Created #1136.

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

No branches or pull requests

4 participants