Skip to content

proc macro server crashes for certain macros #8148

Closed

Description

@lenscas

Continuation from https://www.reddit.com/r/rust/comments/makwv3/rustanalyzer_changelog_69/grt1kul?utm_source=share&utm_medium=web2x&context=3

For some reason the embed_compiler macro from tealr_derive causes the macro server to crash for me. I think I nailed it down to that macro specifically because it only crashes if I have the test for that macro open. The moment I have that test file open the server crashes and a macro that used to work will give me the same error from that point onwards. Only way to get back to a working state is by closing the embed_compiler test file and telling vscode to reload the window.

The proc macro that causes the problem: https://github.com/lenscas/tealr/blob/cee2363a14c53b995a69efb2b4cbd84010905276/tealr_derive/src/lib.rs#L242

the test that causes the crash: https://github.com/lenscas/tealr/blob/master/tealr/tests/embed_teal.rs
The test that doesn't crash:https://github.com/lenscas/tealr/blob/master/tealr/tests/function_wrapper.rs

For what it is worth, the compile_inline_teal macro gives me the type &{unknown} back according to rust analyzer.

Activity

  1. lnicola commented on Mar 22, 2021

    @lnicola
    Member

    For me, compile_inline_teal! crashes because of the println! at https://github.com/lenscas/tealr/blob/cee2363a14c53b995a69efb2b4cbd84010905276/tealr_derive/src/lib.rs#L155:

    [ERROR proc_macro_api::process] proc macro server crashed, server process state: Ok(None), server request error: Custom { kind: InvalidData, error: Error("unknown variant `/home/me/tealr/tealr`, expected one of `Error`, `ListMacro`, `ExpansionMacro`", line: 1, column: 29) }
    

    I also get some errors on embed_compiler!:

    lua: tl:17: module 'argparse' not found:
    	no field package.preload['argparse']
    	no file '/usr/share/lua/5.4/argparse.lua'
    	no file '/usr/share/lua/5.4/argparse/init.lua'
    	no file '/usr/lib/lua/5.4/argparse.lua'
    	no file '/usr/lib/lua/5.4/argparse/init.lua'
    	no file './argparse.lua'
    	no file './argparse/init.lua'
    	no file '/usr/lib/lua/5.4/argparse.so'
    	no file '/usr/lib/lua/5.4/loadall.so'
    	no file './argparse.so'
    stack traceback:
    	[C]: in function 'require'
    	tl:17: in main chunk
    	[C]: in ?
    

    I'm probably missing some lua libraries.

  2. added
    A-macromacro expansion
    S-actionableSomeone could pick this issue up and work on it right now
    on Mar 22, 2021
  3. lnicola commented on Mar 22, 2021

    @lnicola
    Member

    To be clear, the println! is a bad idea because we use stdout for IPC between the proc macro server and the main binary. If you print random stuff to the console, you're injecting it into our communication protocol.

    (marking actionable because we can 1. make the protocol more resilient and 2. someone might still be able to reproduce the other crash, perhaps by installing lua).

  4. lenscas commented on Mar 22, 2021

    @lenscas
    Author

    To be clear, the println! is a bad idea because we use stdout for IPC between the proc macro server and the main binary. If you print random stuff to the console, you're injecting it into our communication protocol.

    Ah, didn't know that. So, I should also capture every output from the commands being run, or is stderr safe to not capture?

    Weird however that compile_inline_teal works for me. As for the lua dependencies, you need tl installed through luarocks, or just its dependencies and comment out the Loca() version. Then the only tests left are the ones that download it themselves instead of relying on a local install.

  5. self-assigned this
    on Mar 22, 2021
  6. edwin0cheng commented on Mar 23, 2021

    @edwin0cheng
    Contributor

    To be clear, the println! is a bad idea because we use stdout for IPC between the proc macro server and the main binary. If you print random stuff to the console, you're injecting it into our communication protocol.

    cc #7954

  7. removed their assignment
    on Mar 23, 2021
  8. vallentin commented on Mar 23, 2021

    @vallentin

    I'm getting a similar "proc macro server crashed" issue, when doing e.g. derive(Serialize).

    At first I thought it might have been in relation to using Rust 1.43.0 where I work, but switching to 1.50.0 and the issue persists.

    Running "Show RA Version" and it displays nothing after "rust-analyzer version:". However, it first started occurring after the latest stable release.


    use serde::{Deserialize, Serialize};
    
    #[derive(Serialize, Deserialize, Debug)]
    pub enum FooBar {
        Foo,
        Bar,
    }

    image

  9. edwin0cheng commented on Mar 23, 2021

    @edwin0cheng
    Contributor

    @vallentin Any error in vscode output ? Because I can't reproduce it in my pc.

  10. vallentin commented on Mar 24, 2021

    @vallentin

    @edwin0cheng For some reason adding the above snippet to a new project, and I can't reproduce it either. But in my existing project it does. I'll see if I can create a MCVE.

    In case it's relevant I'm running WSL + Ubuntu.

    Anyways, if I look in "Output" then I see the following:

    proc-macro /home/vallentin/work/playground/y21w12/target/debug/deps/libserde_derive-f53128d657754e5e.so failed to find the given version. Reason: snappy: corrupt input (expected stream header but got unexpected chunk type byte 188)
    proc-macro /home/vallentin/work/playground/y21w12/target/debug/deps/libserde_derive-f53128d657754e5e.so failed to find the given version. Reason: snappy: corrupt input (expected stream header but got unexpected chunk type byte 188)
    thread 'main' panicked at 'internal error: entered unreachable code', crates/proc_macro_srv/src/proc_macro/bridge/mod.rs:259:5
    stack backtrace:
       0: rust_begin_unwind
                 at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
       1: core::panicking::panic_fmt
                 at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
       2: core::panicking::panic
                 at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
       3: <proc_macro_srv::proc_macro::bridge::api_tags::Method as proc_macro_srv::proc_macro::bridge::rpc::DecodeMut<S>>::decode
       4: <proc_macro_srv::proc_macro::bridge::server::Dispatcher<proc_macro_srv::proc_macro::bridge::server::MarkedTypes<S>> as proc_macro_srv::proc_macro::bridge::server::DispatcherTrait>::dispatch
       5: <proc_macro_srv::proc_macro::bridge::closure::Closure<A,R> as core::convert::From<&mut F>>::from::call
       6: proc_macro::bridge::closure::Closure<A,R>::call
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/closure.rs:27:18
       7: proc_macro::bridge::client::TokenStream::into_iter::{{closure}}
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:237:25
       8: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:321:47
       9: proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:286:17
      10: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/scoped_cell.rs:74:9
      11: proc_macro::bridge::client::BridgeState::with::{{closure}}
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:284:13
      12: std::thread::local::LocalKey<T>::try_with
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:263:16
      13: std::thread::local::LocalKey<T>::with
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:239:9
      14: proc_macro::bridge::client::BridgeState::with
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:283:9
      15: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:314:9
      16: proc_macro::bridge::client::TokenStream::into_iter
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:230:17
      17: proc_macro::token_stream::<impl core::iter::traits::collect::IntoIterator for proc_macro::TokenStream>::into_iter
                 at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/lib.rs:226:22
      18: <proc_macro2::imp::TokenStream as core::iter::traits::collect::IntoIterator>::into_iter
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/wrapper.rs:292:41
      19: proc_macro2::token_stream::<impl core::iter::traits::collect::IntoIterator for proc_macro2::TokenStream>::into_iter
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs:1229:24
      20: syn::buffer::TokenBuffer::inner_new
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:53:19
      21: syn::buffer::TokenBuffer::new2
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:112:9
      22: <F as syn::parse::Parser>::parse2
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1207:19
      23: syn::parse::Parser::parse
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1161:9
      24: syn::parse_macro_input::parse
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse_macro_input.rs:139:5
      25: serde_derive::derive_serialize
                 at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.124/src/lib.rs:85:21
      26: core::ops::function::FnOnce::call_once
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232:5
      27: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::{{closure}}
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:394:40
      28: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:362:26
      29: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79:33
      30: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:74:9
      31: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79:9
      32: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:310:35
      33: std::thread::local::LocalKey<T>::try_with
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263:16
      34: std::thread::local::LocalKey<T>::with
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239:9
      35: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:310:9
      36: proc_macro::bridge::client::run_client::{{closure}}
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:355:9
      37: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318:9
      38: std::panicking::try::do_call
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331:40
      39: __rust_try
      40: std::panicking::try
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274:15
      41: std::panic::catch_unwind
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394:14
      42: proc_macro::bridge::client::run_client
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:354:5
      43: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run
                 at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:394:13
      44: proc_macro_srv::proc_macro::bridge::server::run_server
      45: proc_macro_srv::dylib::Expander::expand
      46: proc_macro_srv::ProcMacroSrv::expand
      47: proc_macro_srv::cli::run
      48: rust_analyzer::main
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    thread 'main' panicked at 'internal error: entered unreachable code', crates/proc_macro_srv/src/proc_macro/bridge/mod.rs:259:5
    stack backtrace:
       0:     0x55e41c193e70 - std::backtrace_rs::backtrace::libunwind::trace::h25e12e0d899beba0
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
       1:     0x55e41c193e70 - std::backtrace_rs::backtrace::trace_unsynchronized::h70e61195d6ae3df6
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       2:     0x55e41c193e70 - std::sys_common::backtrace::_print_fmt::hba93ab80d779695a
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:67:5
       3:     0x55e41c193e70 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf092b5883b4b2e50
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:46:22
       4:     0x55e41c1b940c - core::fmt::write::hf68bc350a8f2f0dc
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/fmt/mod.rs:1078:17
       5:     0x55e41c18d9d2 - std::io::Write::write_fmt::hf66811b1bc767436
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/io/mod.rs:1517:15
       6:     0x55e41c1962b5 - std::sys_common::backtrace::_print::hd425a11bfe1f20f8
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:49:5
       7:     0x55e41c1962b5 - std::sys_common::backtrace::print::h6d678795c1e61e13
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:36:9
       8:     0x55e41c1962b5 - std::panicking::default_hook::{{closure}}::h78a02a4a0dee5e7e
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:208:50
       9:     0x55e41c195e0a - std::panicking::default_hook::h56eb7eda02f355a7
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:225:9
      10:     0x55e41c196a51 - std::panicking::rust_panic_with_hook::hb27ea14285131c61
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:591:17
      11:     0x55e41c196567 - std::panicking::begin_panic_handler::{{closure}}::hc552fcee62aad17f
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:495:13
      12:     0x55e41c19432c - std::sys_common::backtrace::__rust_end_short_backtrace::hb9f0aa9a78e885a0
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:141:18
      13:     0x55e41c1964f9 - rust_begin_unwind
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
      14:     0x55e41c1b6911 - core::panicking::panic_fmt::h12ac4570ea43d06f
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
      15:     0x55e41c1b685d - core::panicking::panic::h72bd72f6f4a70105
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
      16:     0x55e41b3e1970 - <proc_macro_srv::proc_macro::bridge::api_tags::Method as proc_macro_srv::proc_macro::bridge::rpc::DecodeMut<S>>::decode::h4c592e514f3a91b1
      17:     0x55e41b408937 - <proc_macro_srv::proc_macro::bridge::server::Dispatcher<proc_macro_srv::proc_macro::bridge::server::MarkedTypes<S>> as proc_macro_srv::proc_macro::bridge::server::DispatcherTrait>::dispatch::h1874d101c3c17936
      18:     0x55e41b3dea73 - <proc_macro_srv::proc_macro::bridge::closure::Closure<A,R> as core::convert::From<&mut F>>::from::call::hf7ced204bc6fe8a6
      19:     0x7f2527097991 - proc_macro::bridge::closure::Closure<A,R>::call::hae9870fd59b0f7c4
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/closure.rs:27:18
      20:     0x7f2527097991 - proc_macro::bridge::client::TokenStream::into_iter::{{closure}}::h01fdbc3fddd2890f
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:237:25
      21:     0x7f2527097991 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}::hefa6cdaf7d99028c
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:321:47
      22:     0x7f2527097991 - proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}::h88630f5a811dace2
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:286:17
      23:     0x7f2527097991 - proc_macro::bridge::scoped_cell::ScopedCell<T>::replace::hd61bc19f0d534815
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/scoped_cell.rs:74:9
      24:     0x7f2527097991 - proc_macro::bridge::client::BridgeState::with::{{closure}}::h6b8047b77a747616
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:284:13
      25:     0x7f2527097991 - std::thread::local::LocalKey<T>::try_with::ha24fa19947dcf188
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:263:16
      26:     0x7f2527097991 - std::thread::local::LocalKey<T>::with::h3936055334cd0934
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:239:9
      27:     0x7f2527097991 - proc_macro::bridge::client::BridgeState::with::hb50a65a1db57332d
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:283:9
      28:     0x7f2527097991 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::h4ddb34cae1050a7e
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:314:9
      29:     0x7f2527097991 - proc_macro::bridge::client::TokenStream::into_iter::hd093eef7555c14bf
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:230:17
      30:     0x7f2527097991 - proc_macro::token_stream::<impl core::iter::traits::collect::IntoIterator for proc_macro::TokenStream>::into_iter::hfbe2ddba63702bd7
                                   at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/lib.rs:226:22
      31:     0x7f252706c0cc - <proc_macro2::imp::TokenStream as core::iter::traits::collect::IntoIterator>::into_iter::h639b0b9d28e2545a
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/wrapper.rs:292:41
      32:     0x7f2527075139 - proc_macro2::token_stream::<impl core::iter::traits::collect::IntoIterator for proc_macro2::TokenStream>::into_iter::hd204b0a882113219
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs:1229:24
      33:     0x7f252701606b - syn::buffer::TokenBuffer::inner_new::h60536052bad27dae
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:53:19
      34:     0x7f2527016cdd - syn::buffer::TokenBuffer::new2::ha15528a044e9b140
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:112:9
      35:     0x7f2526efda93 - <F as syn::parse::Parser>::parse2::hcdf1469fb156b740
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1207:19
      36:     0x7f2526efd9ea - syn::parse::Parser::parse::h0417ce86f6a18876
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1161:9
      37:     0x7f2526efd978 - syn::parse_macro_input::parse::h98a3e78fa47ad320
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse_macro_input.rs:139:5
      38:     0x7f2526f0d792 - serde_derive::derive_deserialize::h77aa9b5e1e5db025
                                   at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.124/src/lib.rs:93:21
      39:     0x7f2526f10475 - core::ops::function::FnOnce::call_once::hc67121f70d480ef0
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232:5
      40:     0x7f2526f0e9e6 - proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::{{closure}}::h66b048df93c6d00d
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:394:40
      41:     0x7f2526f0e09f - proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::h8ae7bd45fd938bf8
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:362:26
      42:     0x7f2526ee0a97 - proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}::h08f95269dcc3b5c4
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79:33
      43:     0x7f2526ee0cea - proc_macro::bridge::scoped_cell::ScopedCell<T>::replace::h0a59541af9d4dbd3
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:74:9
      44:     0x7f2526ee0a71 - proc_macro::bridge::scoped_cell::ScopedCell<T>::set::hd1a6f2289d78c46e
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/scoped_cell.rs:79:9
      45:     0x7f2526f0e88d - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::hdc3fa2015c7bbd48
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:310:35
      46:     0x7f2526e84e3c - std::thread::local::LocalKey<T>::try_with::h9de3545a66214e38
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263:16
      47:     0x7f2526e84987 - std::thread::local::LocalKey<T>::with::h6a2cb9567c499e4f
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239:9
      48:     0x7f2526efd83c - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::h558d9ca9dac413c4
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:310:9
      49:     0x7f2526f0def2 - proc_macro::bridge::client::run_client::{{closure}}::h79bec6fbed271763
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:355:9
      50:     0x7f2526edcb72 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hf93c872a8bd81870
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318:9
      51:     0x7f2526e6b9a2 - std::panicking::try::do_call::h271fbd9d10278100
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331:40
      52:     0x7f2526e779ed - __rust_try
      53:     0x7f2526e6b8c0 - std::panicking::try::h167bfab55a5eb7eb
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274:15
      54:     0x7f2526ee4572 - std::panic::catch_unwind::hb708d46ed82255dc
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394:14
      55:     0x7f2526f0ddbf - proc_macro::bridge::client::run_client::h9b2b555625d8cca0
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:354:5
      56:     0x7f2526f0e99d - proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run::hc7db7c44198ab18f
                                   at /home/vallentin/.rustup/toolchains/1.44.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libproc_macro/bridge/client.rs:394:13
      57:     0x55e41b408475 - proc_macro_srv::proc_macro::bridge::server::run_server::h35dc180528590974
      58:     0x55e41b403902 - proc_macro_srv::dylib::Expander::expand::h24aaa930b521316d
      59:     0x55e41b3ebed6 - proc_macro_srv::ProcMacroSrv::expand::ha29ddbaceaecd05b
      60:     0x55e41b3dee90 - proc_macro_srv::cli::run::h9e8c9c072ccb9a82
      61:     0x55e41b3a83b9 - rust_analyzer::main::he85ee484ee73d91b
      62:     0x55e41b3cf013 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9e7929197aa27d83
      63:     0x55e41b3cf4a9 - std::rt::lang_start::{{closure}}::h7fe8a2e337373efb
      64:     0x55e41c196f67 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h78040f802d89ccdc
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/ops/function.rs:259:13
      65:     0x55e41c196f67 - std::panicking::try::do_call::h6853cad536dd09a1
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:379:40
      66:     0x55e41c196f67 - std::panicking::try::h827495f03a9fbb9a
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:343:19
      67:     0x55e41c196f67 - std::panic::catch_unwind::h4bdf17571090eb17
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panic.rs:396:14
      68:     0x55e41c196f67 - std::rt::lang_start_internal::h2f319c33bb013f29
                                   at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/rt.rs:51:25
      69:     0x55e41b3aac52 - main
      70:     0x7f252727c0b3 - __libc_start_main
      71:     0x55e41b346659 - _start
      72:                0x0 - <unknown>
    thread panicked while panicking. aborting.
    [ERROR proc_macro_api::process] proc macro server crashed, server process state: Ok(Some(ExitStatus(ExitStatus(4)))), server request error: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }
  11. bjorn3 commented on Mar 24, 2021

    @bjorn3
    Member

    Which rustc version are you using?

  12. vallentin commented on Mar 24, 2021

    @vallentin

    @bjorn3 I was using 1.43.0, and I thought it might have been the issue. However, after I switched to 1.50.0, then the issue still occurred.

  13. lnicola commented on Mar 27, 2021

    @lnicola
    Member
    proc-macro /home/vallentin/work/playground/y21w12/target/debug/deps/libserde_derive-f53128d657754e5e.so failed to find the given version. Reason: snappy: corrupt input (expected stream header but got unexpected chunk type byte 188)
    proc-macro /home/vallentin/work/playground/y21w12/target/debug/deps/libserde_derive-f53128d657754e5e.so failed to find the given version. Reason: snappy: corrupt input (expected stream header but got unexpected chunk type byte 188)
    

    That's unexpected, right?

  14. edwin0cheng commented on Mar 27, 2021

    @edwin0cheng
    Contributor

    That's unexpected, right?

    Um.. that's strange. maybe some old libc or linker bugs ?

    @vallentin What Ubuntu version you are using ?

    If possible, could you try to run cargo clean and see if the issue is still there ?

  15. vallentin commented on Mar 27, 2021

    @vallentin

    @edwin0cheng

    From the welcome message:

    Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.72-microsoft-standard-WSL2 x86_64)


    The even weirder thing is that after I commented about the issue, things have actually escalated even worse. I randomly get syntax errors like "expected semicolon". One instance I remember, is where I literally just removed an import, and it complained about missing semicolon. Then I did Ctrl+Z, and the error remained. If I pushed the import lines down, the error would stay at the now empty line.

    I also had an instance there an impl Foo complained about Foo not existing, while the struct Foo was literally just above.

    Even though rust-analyzer showed all those errors, everything compiles fine with cargo build, and doing "RA Restart Server" and the errors are gone as well. New errors quickly appear.

    The above issues started occurring and increasing in frequency during a "VSCode Live Share" session, with me and another coworker while talking about some design stuff.

    As an extra comment, it only happens in WSL+Ubuntu, it doesn't happen on my Windows machine. Even when both use Rust 1.51.

    I'll try and do cargo clean on Monday, and report back whether the issues stop.

  16. itsxaos commented on Mar 30, 2021

    @itsxaos

    This might not be related to the issue directly, but I was having the same proc macro server crashed problem and I managed to fix it by setting the right default toolchain.
    Since I'm quite new to using rust I was unaware that there can be multiple versions of rust on the same machine, and so I was running an older version of rustc even though I updated all my packages and ran rustup update.
    I fixed it by running rustup show to see all the installed toolchains and selecting the newest with:
    rustup default stable-x86_64-unknown-linux-gnu
    I ran cargo clean just to be safe and now everything works again.

  17. lnicola commented on Apr 8, 2021

    @lnicola
    Member

    Oh, I just saw this in a project that uses a rust-toolchain override to 1.46.

  18. edward-shen commented on Apr 9, 2021

    @edward-shen

    Also seeing this in a project that uses has rust-toolchain 1.46 and on a serde derive macro on an Arch Linux install even after a cargo clean, so I think it's a platform agnostic issue. I'm unable to reproduce the issue on projects without the rust-toolchain file.

  19. lnicola commented on Apr 9, 2021

    @lnicola
    Member

    So it looks like the metadata format changed at some point without actually changing the version (see #6822 for more details).

  20. edward-shen commented on Apr 9, 2021

    @edward-shen

    In that case, is the only workaround to right now is to disable proc-macro expansion and wait for a future update?

  21. edwin0cheng commented on Apr 9, 2021

    @edwin0cheng
    Contributor

    IIRC, the format changed around 4 months ago, so I think after 1.50 should be fine.

  22. lnicola commented on Apr 9, 2021

    @lnicola
    Member

    The other workaround is to temporarily remove the rust-toolchain file.

  23. flodiebold commented on May 21, 2021

    @flodiebold
    Member

    Is there anything left to do here? I think we've addressed the original issue about printing proc macros as far as possible, and we don't support older rustc versions.

  24. vallentin commented on May 21, 2021

    @vallentin

    For what it's worth, I can add that since the 2 months ago, where I commented a somewhat related issue. I did cargo clean back then and haven't experienced the issue since.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macromacro expansionS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions