Skip to content

panic: truncate extracted a pending value that references internal binder #2688

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

Closed
Speedy37 opened this issue Dec 30, 2019 · 8 comments
Closed
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in

Comments

@Speedy37
Copy link
Contributor

Rust analyzer is panicking very fast after I open my project.

thread 'main' panicked at 'truncate extracted a pending value that references internal binder: Ty(StructId(1008)<^0, ?0>)', C:\Users\Vincent\.cargo\git\checkouts\chalk-7b02fa8caa2cec94\ff65b5a\chalk-solve\src\solve\slg\resolvent.rs:286:17
stack backtrace:
   0: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\sys_common\backtrace.rs:61
   1: core::fmt::write
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libcore\fmt\mod.rs:1028
   2: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\io\mod.rs:1412
   3: std::panicking::default_hook::{{closure}}
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\panicking.rs:188
   4: std::panicking::default_hook
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\panicking.rs:205
   5: std::panicking::rust_panic_with_hook
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\panicking.rs:464
   6: std::panicking::continue_panic_fmt
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\panicking.rs:373
   7: std::panicking::begin_panic_fmt
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\panicking.rs:328
   8: <chalk_solve::solve::slg::resolvent::AnswerSubstitutor<TF> as chalk_ir::zip::Zipper<TF>>::zip_tys
   9: <chalk_solve::solve::slg::resolvent::AnswerSubstitutor<TF> as chalk_ir::zip::Zipper<TF>>::zip_tys
  10: <chalk_solve::solve::slg::resolvent::AnswerSubstitutor<TF> as chalk_ir::zip::Zipper<TF>>::zip_binders
  11: <chalk_solve::solve::slg::resolvent::AnswerSubstitutor<TF> as chalk_ir::zip::Zipper<TF>>::zip_tys
  12: <alloc::vec::Vec<T> as chalk_ir::zip::Zip<TF>>::zip_with
  13: <chalk_ir::Goal<TF> as chalk_ir::zip::Zip<TF>>::zip_with
  14: ZN11chalk_solve5solve3slg9resolvent178_$LT$impl$u20$chalk_engine..context..ResolventOps$LT$chalk_solve..solve..slg..SlgContext$LT$TF$GT$$GT$$u20$for$u20$chalk_solve..solve..slg..TruncatingInferenceTable$LT$TF$GT$$GT$18apply_answer_subst17ha970eb2cd27fef7c
  15: <chalk_engine::forest::ForestSolver<C,CO> as chalk_engine::context::AnswerStream<C>>::any_future_answer
  16: <chalk_engine::forest::ForestSolver<C,CO> as chalk_engine::context::AnswerStream<C>>::any_future_answer
  17: <chalk_engine::forest::ForestSolver<C,CO> as chalk_engine::context::AnswerStream<C>>::peek_answer
  18: chalk_solve::solve::slg::aggregate::<impl chalk_engine::context::AggregateOps<chalk_solve::solve::slg::SlgContext<TF>> for chalk_solve::solve::slg::SlgContextOps<TF>>::make_solution
  19: chalk_engine::forest::Forest<C>::solve
  20: ra_hir_ty::traits::trait_solve_query
  21: salsa::runtime::Runtime<DB>::execute_query_implementation
  22: core::ptr::real_drop_in_place
  23: salsa::derived::slot::Slot<DB,Q,MP>::read
  24: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch
  25: salsa::QueryTable<DB,Q>::get
  26: ra_hir_ty::method_resolution::iterate_method_candidates
  27: ra_hir_ty::method_resolution::lookup_method
  28: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  29: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  30: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  31: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  32: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  33: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  34: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  35: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  36: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  37: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  38: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  39: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  40: ra_hir_ty::infer::pat::<impl ra_hir_ty::infer::InferenceContext<D>>::infer_pat
  41: ra_hir_ty::infer::infer_query
  42: salsa::runtime::Runtime<DB>::execute_query_implementation
  43: core::ptr::real_drop_in_place
  44: salsa::derived::slot::Slot<DB,Q,MP>::read
  45: <salsa::derived::DerivedStorage<DB,Q,MP> as salsa::plumbing::QueryStorageOps<DB,Q>>::try_fetch
  46: ra_hir::code_model::Struct::fields
  47: ra_hir::code_model::Module::diagnostics
  48: ra_ide::diagnostics::diagnostics
  49: std::panicking::try::do_call
  50: panic_unwind::__rust_maybe_catch_panic
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libpanic_unwind\lib.rs:78
  51: ra_db::CheckCanceled::catch_canceled
  52: ra_ide::Analysis::diagnostics
  53: ra_lsp_server::main_loop::handlers::publish_diagnostics
  54: <ra_lsp_server::main_loop::Event as core::fmt::Debug>::fmt
  55: ra_lsp_server::main_loop::main_loop
  56: core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}
  57: <T as core::any::Any>::type_id
  58: std::panicking::try::do_call<closure-0,i32>
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\panicking.rs:287
  59: panic_unwind::__rust_maybe_catch_panic
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libpanic_unwind\lib.rs:78
  60: std::rt::lang_start_internal
             at /rustc/73528e339aae0f17a15ffa49a8ac608f50c6cf14\/src\libstd\rt.rs:47
  61: main
  62: __scrt_common_main_seh
             at d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  63: BaseThreadInitThunk
  64: RtlUserThreadStart
@Speedy37
Copy link
Contributor Author

I'm on master (28ef2ea) with pull #2672 applied.

@Speedy37
Copy link
Contributor Author

Speedy37 commented Dec 30, 2019

git bisect results between (c5a48be) and (28ef2ea):

git bisect start
# bad: [28ef2ea4f98e7e5c4e1df73e2e120dea7d279357] Merge #2687
git bisect bad 28ef2ea4f98e7e5c4e1df73e2e120dea7d279357
# good: [c5a48bea1218afb63d7932a6816f34c810bbab6b] Merge #2671
git bisect good c5a48bea1218afb63d7932a6816f34c810bbab6b
# good: [25537d294cb7a3e01d2329a7d07b469d734fc829] Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061#discussion_r348716036 Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061/files/68a5ff050faf514e9d122212a66703ca8ce66ab7#r361019340
git bisect good 25537d294cb7a3e01d2329a7d07b469d734fc829
# bad: [dc48f89581843248660ceb755bb20469ab6ac0c9] Merge #2668
git bisect bad dc48f89581843248660ceb755bb20469ab6ac0c9
# bad: [c732f215cb31e9f022090b8d0212f6ea9c134c11] Don't finish main cargo watch thread when subprocess finishes.
git bisect bad c732f215cb31e9f022090b8d0212f6ea9c134c11
# bad: [f7d04d05756e7074de2b73b35718b5b4ae670d1b] Re-format ra_lsp_server changes
git bisect bad f7d04d05756e7074de2b73b35718b5b4ae670d1b
# bad: [17360b5d14ec98085169bfb344b220dcfc75b9f0] Fix use of wrong message in diagnostic
git bisect bad 17360b5d14ec98085169bfb344b220dcfc75b9f0
# bad: [41a1ec723ce2ea3fa78ae468830f0a77e5658307] Remove cargo-watch from vscode extension.
git bisect bad 41a1ec723ce2ea3fa78ae468830f0a77e5658307
# bad: [66e8ef53a0ed018d03340577a0443030a193f773] Initial implementation of cargo check watching
git bisect bad 66e8ef53a0ed018d03340577a0443030a193f773
# first bad commit: [66e8ef53a0ed018d03340577a0443030a193f773] Initial implementation of cargo check watching

This in on Windows 10 Pro 1909
I notice the panic always occur at about 1.2GB memory usage and the CPU usage doesn't drop below 1 maxed core.
I'm not sure why the cargo watch change would be the cause as the panic seems related to chalk.

Edit:
Here is a screen cap of CPU time
image

Looks like diagnostics are causing queries to run that weren't run with the previous cargo watch impl

@edwin0cheng
Copy link
Member

Um.. I just deleted my comment , I was thought it is related to #2675, but it maybe unrelated.

@edwin0cheng
Copy link
Member

The panic is same as #2380, unfortunately, that is still not fixed. :(

@Speedy37
Copy link
Contributor Author

Speedy37 commented Dec 31, 2019

Chalk upstream issue rust-lang/chalk#301
The crash always happen when I change and save a file (just a space for example).
The new cargo check thing also seems (if I ignore this crash) to make the initial load on lsp server much more intense as the project need about 20/30s before starting to get responsive. I can't really test after an edit, but it takes about 10/15s after an edit before it crash.

@djc
Copy link

djc commented Jan 1, 2020

I also see this happening after updating rust-analyzer yesterday (for the first time).

@matklad matklad added the E-unknown It's unclear if the issue is E-hard or E-easy without digging in label Jan 6, 2020
@djc
Copy link

djc commented Jan 12, 2020

This is making rust-analyzer unusable for me. :(

@Speedy37
Copy link
Contributor Author

Speedy37 commented Feb 6, 2020

Since the last big chalk upgrade, no more crashes.

@Speedy37 Speedy37 closed this as completed Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in
Projects
None yet
Development

No branches or pull requests

4 participants