Skip to content

Request textDocument/inlayHint failed. #12770

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
aurexav opened this issue Jul 16, 2022 · 21 comments
Closed

Request textDocument/inlayHint failed. #12770

aurexav opened this issue Jul 16, 2022 · 21 comments
Labels
A-ty type system / type inference / traits / method resolution

Comments

@aurexav
Copy link

aurexav commented Jul 16, 2022

It works well on small projects.
But not works on https://github.com/darwinia-network/darwinia-common

version: 0.0.0 (5342f47f4 2022-07-09)
request: textDocument/semanticTokens/full SemanticTokensParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/root/code/darwinia-network/common/node/runtime/template/src/pallets/evm.rs",
            query: None,
            fragment: None,
        },
    },
}

thread 'Worker' panicked at 'overflow depth reached', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-recursive-0.83.0/src/fixed_point/stack.rs:51:13
stack backtrace:
   0: std::panicking::begin_panic
   1: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
   2: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
   3: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
   4: chalk_recursive::solve::SolveIteration::solve_iteration
   5: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
   6: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
   7: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
   8: chalk_recursive::solve::SolveIteration::solve_iteration
   9: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  10: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  11: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  12: chalk_recursive::solve::SolveIteration::solve_iteration
  13: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  14: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  15: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  16: chalk_recursive::solve::SolveIteration::solve_iteration
  17: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  18: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  19: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  20: chalk_recursive::solve::SolveIteration::solve_iteration
  21: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  22: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  23: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  24: chalk_recursive::solve::SolveIteration::solve_iteration
  25: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  26: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  27: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  28: chalk_recursive::solve::SolveIteration::solve_iteration
  29: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  30: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  31: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  32: chalk_recursive::solve::SolveIteration::solve_iteration
  33: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  34: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  35: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  36: chalk_recursive::solve::SolveIteration::solve_iteration
  37: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  38: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  39: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  40: chalk_recursive::solve::SolveIteration::solve_iteration
  41: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  42: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  43: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  44: chalk_recursive::solve::SolveIteration::solve_iteration
  45: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  46: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  47: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  48: chalk_recursive::solve::SolveIteration::solve_iteration
  49: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  50: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  51: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  52: chalk_recursive::solve::SolveIteration::solve_iteration
  53: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  54: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  55: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  56: chalk_recursive::solve::SolveIteration::solve_iteration
  57: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  58: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  59: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  60: chalk_recursive::solve::SolveIteration::solve_iteration
  61: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  62: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  63: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  64: chalk_recursive::solve::SolveIteration::solve_iteration
  65: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  66: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  67: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  68: chalk_recursive::solve::SolveIteration::solve_iteration
  69: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  70: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  71: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  72: chalk_recursive::solve::SolveIteration::solve_iteration
  73: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  74: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  75: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  76: chalk_recursive::solve::SolveIteration::solve_iteration
  77: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  78: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  79: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  80: chalk_recursive::solve::SolveIteration::solve_iteration
  81: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  82: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  83: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  84: chalk_recursive::solve::SolveIteration::solve_iteration
  85: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  86: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  87: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  88: chalk_recursive::solve::SolveIteration::solve_iteration
  89: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  90: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  91: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 1:28:10 PM] Request textDocument/semanticTokens/full failed.
  Message: request handler panicked: overflow depth reached
  Code: -32603 

And if I increase the "CHALK_OVERFLOW_DEPTH": "4096".

[Error - 1:22:00 PM] Request textDocument/inlayHint failed.
  Message: Invalid offset
  Code: -32603 

thread 'Worker' has overflowed its stack
fatal runtime error: stack overflow
[Info  - 1:22:55 PM] Connection to server got closed. Server will restart.
@lnicola
Copy link
Member

lnicola commented Jul 16, 2022

Presumably a dupe of #12484.

@aurexav aurexav closed this as completed Jul 18, 2022
@aurexav
Copy link
Author

aurexav commented Jul 18, 2022

Close, as #12484 fixed.

@aurexav
Copy link
Author

aurexav commented Jul 19, 2022

Still got this.

@aurexav aurexav reopened this Jul 19, 2022
@bjorn3 bjorn3 added the A-ty type system / type inference / traits / method resolution label Jul 19, 2022
@lnicola
Copy link
Member

lnicola commented Jul 19, 2022

A minimized example would probably be useful here, but it's not exactly trivial to get.

@aurexav aurexav changed the title Message: request handler panicked: overflow depth reached Request textDocument/inlayHint failed. Jul 22, 2022
@aurexav
Copy link
Author

aurexav commented Jul 22, 2022

Panic context:
> 
version: 0.4.1136-standalone (84a6fac37 2022-07-21)
notification: textDocument/didChange

thread 'LspServer' panicked at 'assertion failed: start <= end', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/text-size-1.1.0/src/range.rs:48:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:48:5
   3: rust_analyzer::from_proto::text_range
   4: rust_analyzer::lsp_utils::apply_document_changes
   5: core::ops::function::FnOnce::call_once
   6: rust_analyzer::dispatch::NotificationDispatcher::on
   7: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
   8: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
   9: rust_analyzer::main_loop::main_loop
  10: rust_analyzer::run_server
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', lib/lsp-server/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Info  - 3:36:23 PM] Connection to server got closed. Server will restart.
[Error - 3:36:27 PM] Request textDocument/inlayHint failed.
  Message: Invalid offset

@aurexav
Copy link
Author

aurexav commented Jul 22, 2022

Sorry, I don't have too much knowledge about this.

git clone https://github.com/darwinia-network/darwinia-common.git
git checkout xavier/test

open this repo in vscode
go to node/runtime/pangolin/src/pallets/evm.rs will trigger the first overflow error
sometimes, I got the second error, but I can not reproduce it every time

@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

The way I tried to do it was to run rust-analyzer analysis-stats ., notice that it crashed on SubstrateBlockHashMapping::block_hash in frame/dvm/evm/src/lib.rs, then macro-expanded and started trimming down the code while it still crashed (it doesn't really have to compile).

But after spending some time on it, I realized that the crash had moved from frame/dvm/evm/src/lib.rs to frame/dvm/evm/src/runner/stack.rs, so my tests were bogus.

Of course, a crash is still a crash, and I could have continued trimming down stack.rs instead, but these could be two different bugs.

@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

Panic location is here

if let Ok(range) = from_proto::text_range(&line_index, range) {

Meaning we crashed on an invalid range in the lsp_types::notification::DidChangeTextDocument handler ... So the client send us a faulty range (unlikely) or our line index mapping is faulty (more likely)

Oh, actually maybe we processed something out of order here instead! A few possible causes, but doesn't sound like something easily reproducible

@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

Right, there are two panics here 😄.

@Veykril
Copy link
Member

Veykril commented Jul 22, 2022

Ye, we don't catch panics in notification handlers it seems so the server just dies in that case :) I think that's an oversight. Ah no this is intentional

@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

No, I meant the overflow depth reached in chalk in the first comment, which still reproduces.

@kianenigma
Copy link

Any temporary hack to fix this by any chance?

@0x7CFE
Copy link

0x7CFE commented Sep 6, 2022

Still get similar issue on rust-analyzer version: 0.4.1193-standalone (67920f797 2022-09-04)

@lnicola
Copy link
Member

lnicola commented Sep 6, 2022

@0x7CFE you should have some panics in the log window, can you paste them?

@0x7CFE
Copy link

0x7CFE commented Sep 6, 2022

@lnicola, sure. I'm using the following repo: AstarNetwork/astar-frame@b1f286e

I tried to hover over some stuff and get the following output below.

P.S.: There are other errors that happen upon project loading or on nearly any action in the editor. So it's related not only to inline hints.

[Error - 4:25:10 PM] Request textDocument/inlayHint failed.
  Message: request handler panicked: overflow depth reached
  Code: -32603 
Panic context:
> 
version: 0.4.1195-standalone (6dfd8aebd 2022-09-05)
request: textDocument/inlayHint InlayHintParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/home/korvin/work/AstarNetwork/astar-frame/precompiles/xcm/src/lib.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 105,
            character: 47,
        },
    },
}

thread 'Worker' panicked at 'overflow depth reached', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-recursive-0.84.0/src/fixed_point/stack.rs:51:13
stack backtrace:
   0: std::panicking::begin_panic
   1: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
   2: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
   3: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
   4: chalk_recursive::solve::SolveIteration::solve_iteration
   5: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
   6: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
   7: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
   8: chalk_recursive::solve::SolveIteration::solve_iteration
   9: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  10: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  11: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  12: chalk_recursive::solve::SolveIteration::solve_iteration
  13: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  14: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  15: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  16: chalk_recursive::solve::SolveIteration::solve_iteration
  17: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  18: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  19: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  20: chalk_recursive::solve::SolveIteration::solve_iteration
  21: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  22: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  23: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  24: chalk_recursive::solve::SolveIteration::solve_iteration
  25: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  26: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  27: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  28: chalk_recursive::solve::SolveIteration::solve_iteration
  29: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  30: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  31: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  32: chalk_recursive::solve::SolveIteration::solve_iteration
  33: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  34: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  35: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  36: chalk_recursive::solve::SolveIteration::solve_iteration
  37: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  38: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  39: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  40: chalk_recursive::solve::SolveIteration::solve_iteration
  41: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  42: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  43: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  44: chalk_recursive::solve::SolveIteration::solve_iteration
  45: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  46: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  47: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  48: chalk_recursive::solve::SolveIteration::solve_iteration
  49: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  50: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  51: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  52: chalk_recursive::solve::SolveIteration::solve_iteration
  53: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  54: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  55: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  56: chalk_recursive::solve::SolveIteration::solve_iteration
  57: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  58: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  59: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  60: chalk_recursive::solve::SolveIteration::solve_iteration
  61: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  62: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  63: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  64: chalk_recursive::solve::SolveIteration::solve_iteration
  65: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  66: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  67: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  68: chalk_recursive::solve::SolveIteration::solve_iteration
  69: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  70: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  71: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  72: chalk_recursive::solve::SolveIteration::solve_iteration
  73: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  74: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  75: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  76: chalk_recursive::solve::SolveIteration::solve_iteration
  77: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  78: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  79: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  80: chalk_recursive::solve::SolveIteration::solve_iteration
  81: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  82: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  83: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  84: chalk_recursive::solve::SolveIteration::solve_iteration
  85: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  86: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  87: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
  88: chalk_recursive::solve::SolveIteration::solve_iteration
  89: chalk_recursive::fixed_point::RecursiveContext<K,V>::solve_goal
  90: chalk_recursive::fulfill::Fulfill<I,Solver>::prove
  91: chalk_recursive::fulfill::Fulfill<I,Solver>::solve
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@aurexav
Copy link
Author

aurexav commented Sep 6, 2022

It looks like all the EVM base projects encounter this error.

@kianenigma
Copy link

If we had #8275, we could exclude those (in case you are working in a mono-repo).

@Veykril
Copy link
Member

Veykril commented Jan 19, 2023

Can anyone confirm whether this issue still persists on the latest rust-analyzer? I believe chalk should no longer panic here but instead run out of fuel?

@aurexav
Copy link
Author

aurexav commented Jan 19, 2023

I can't see this error now.

@aurexav aurexav closed this as completed Jan 19, 2023
@pls-kick-me
Copy link

The same errors here:
Request textDocument/inlayHint failed.
Request textDocument/documentHighlight failed.
Request textDocument/semanticTokens/full/delta failed.

This code cause an errors above:

#[macro_use]
extern crate rocket; // rocket.rs

@pls-kick-me
Copy link

And again
"I can't see this error now.".
Strange...
Only one day has passed and the error has disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution
Projects
None yet
Development

No branches or pull requests

7 participants