You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
proc macro server crashes for certain macros #8148
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.
[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 ?
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).
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.
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.
@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:51:core::panicking::panic_fmt
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:142:core::panicking::panic
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:53: <proc_macro_srv::proc_macro::bridge::api_tags::Methodas 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<&mutF>>::from::call
6: proc_macro::bridge::closure::Closure<A,R>::call
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/closure.rs:27:187:proc_macro::bridge::client::TokenStream::into_iter::{{closure}}
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:237:258:proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:321:479:proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:286:1710:proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/scoped_cell.rs:74:911:proc_macro::bridge::client::BridgeState::with::{{closure}}
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:284:1312:std::thread::local::LocalKey<T>::try_with
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:263:1613:std::thread::local::LocalKey<T>::with
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:239:914:proc_macro::bridge::client::BridgeState::with
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:283:915:proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:314:916:proc_macro::bridge::client::TokenStream::into_iter
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:230:1717:proc_macro::token_stream::<impl core::iter::traits::collect::IntoIteratorfor proc_macro::TokenStream>::into_iter
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/lib.rs:226:2218: <proc_macro2::imp::TokenStreamas 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:4119: proc_macro2::token_stream::<impl core::iter::traits::collect::IntoIteratorfor proc_macro2::TokenStream>::into_iter
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs:1229:2420: syn::buffer::TokenBuffer::inner_new
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:53:1921: syn::buffer::TokenBuffer::new2
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:112:922: <Fas syn::parse::Parser>::parse2
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1207:1923: syn::parse::Parser::parse
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1161:924: syn::parse_macro_input::parse
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse_macro_input.rs:139:525: serde_derive::derive_serialize
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.124/src/lib.rs:85:2126: 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:527: 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:4028: 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:2629: 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:3330: 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:931: 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:932: 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:3533: 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:1634: 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:935: 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:936: 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:937: <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:938: 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:4039: __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:1541: 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:1442: 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:543: 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:1344: 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:51:0x55e41c193e70 - std::backtrace_rs::backtrace::trace_unsynchronized::h70e61195d6ae3df6
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:52:0x55e41c193e70 - std::sys_common::backtrace::_print_fmt::hba93ab80d779695a
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:67:53:0x55e41c193e70 - <std::sys_common::backtrace::_print::DisplayBacktraceas core::fmt::Display>::fmt::hf092b5883b4b2e50
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:46:224:0x55e41c1b940c - core::fmt::write::hf68bc350a8f2f0dc
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/fmt/mod.rs:1078:175:0x55e41c18d9d2 - std::io::Write::write_fmt::hf66811b1bc767436
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/io/mod.rs:1517:156:0x55e41c1962b5 - std::sys_common::backtrace::_print::hd425a11bfe1f20f8
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:49:57:0x55e41c1962b5 - std::sys_common::backtrace::print::h6d678795c1e61e13
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:36:98:0x55e41c1962b5 - std::panicking::default_hook::{{closure}}::h78a02a4a0dee5e7e
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:208:509:0x55e41c195e0a - std::panicking::default_hook::h56eb7eda02f355a7
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:225:910:0x55e41c196a51 - std::panicking::rust_panic_with_hook::hb27ea14285131c61
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:591:1711:0x55e41c196567 - std::panicking::begin_panic_handler::{{closure}}::hc552fcee62aad17f
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:495:1312:0x55e41c19432c - std::sys_common::backtrace::__rust_end_short_backtrace::hb9f0aa9a78e885a0
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/sys_common/backtrace.rs:141:1813:0x55e41c1964f9 - rust_begin_unwind
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:514:0x55e41c1b6911 - core::panicking::panic_fmt::h12ac4570ea43d06f
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:1415:0x55e41c1b685d - core::panicking::panic::h72bd72f6f4a70105
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:516:0x55e41b3e1970 - <proc_macro_srv::proc_macro::bridge::api_tags::Methodas 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<&mutF>>::from::call::hf7ced204bc6fe8a6
19:0x7f2527097991 - proc_macro::bridge::closure::Closure<A,R>::call::hae9870fd59b0f7c4
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/closure.rs:27:1820:0x7f2527097991 - proc_macro::bridge::client::TokenStream::into_iter::{{closure}}::h01fdbc3fddd2890f
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:237:2521:0x7f2527097991 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::{{closure}}::hefa6cdaf7d99028c
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:321:4722:0x7f2527097991 - proc_macro::bridge::client::BridgeState::with::{{closure}}::{{closure}}::h88630f5a811dace2
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:286:1723:0x7f2527097991 - proc_macro::bridge::scoped_cell::ScopedCell<T>::replace::hd61bc19f0d534815
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/scoped_cell.rs:74:924:0x7f2527097991 - proc_macro::bridge::client::BridgeState::with::{{closure}}::h6b8047b77a747616
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:284:1325:0x7f2527097991 - std::thread::local::LocalKey<T>::try_with::ha24fa19947dcf188
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:263:1626:0x7f2527097991 - std::thread::local::LocalKey<T>::with::h3936055334cd0934
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libstd/thread/local.rs:239:927:0x7f2527097991 - proc_macro::bridge::client::BridgeState::with::hb50a65a1db57332d
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:283:928:0x7f2527097991 - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with::h4ddb34cae1050a7e
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:314:929:0x7f2527097991 - proc_macro::bridge::client::TokenStream::into_iter::hd093eef7555c14bf
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/bridge/client.rs:230:1730:0x7f2527097991 - proc_macro::token_stream::<impl core::iter::traits::collect::IntoIteratorfor proc_macro::TokenStream>::into_iter::hfbe2ddba63702bd7
at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4/src/libproc_macro/lib.rs:226:2231:0x7f252706c0cc - <proc_macro2::imp::TokenStreamas 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:4132:0x7f2527075139 - proc_macro2::token_stream::<impl core::iter::traits::collect::IntoIteratorfor proc_macro2::TokenStream>::into_iter::hd204b0a882113219
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.24/src/lib.rs:1229:2433:0x7f252701606b - syn::buffer::TokenBuffer::inner_new::h60536052bad27dae
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:53:1934:0x7f2527016cdd - syn::buffer::TokenBuffer::new2::ha15528a044e9b140
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/buffer.rs:112:935:0x7f2526efda93 - <Fas syn::parse::Parser>::parse2::hcdf1469fb156b740
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1207:1936:0x7f2526efd9ea - syn::parse::Parser::parse::h0417ce86f6a18876
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.64/src/parse.rs:1161:937: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:538:0x7f2526f0d792 - serde_derive::derive_deserialize::h77aa9b5e1e5db025
at /home/vallentin/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_derive-1.0.124/src/lib.rs:93:2139: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:540: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:4041: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:2642: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:3343: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:944: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:945: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:3546: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:1647: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:948: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:949: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:950: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:951: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:4052: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:1554: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:1455: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:556: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:1357: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:1365:0x55e41c196f67 - std::panicking::try::do_call::h6853cad536dd09a1
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:379:4066:0x55e41c196f67 - std::panicking::try::h827495f03a9fbb9a
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:343:1967:0x55e41c196f67 - std::panic::catch_unwind::h4bdf17571090eb17
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panic.rs:396:1468:0x55e41c196f67 - std::rt::lang_start_internal::h2f319c33bb013f29
at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/rt.rs:51:2569: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" }
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)
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.
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.
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.
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.
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.
Activity
lnicola commentedon Mar 22, 2021
For me,
compile_inline_teal!crashes because of theprintln!at https://github.com/lenscas/tealr/blob/cee2363a14c53b995a69efb2b4cbd84010905276/tealr_derive/src/lib.rs#L155:I also get some errors on
embed_compiler!:I'm probably missing some
lualibraries.lnicola commentedon Mar 22, 2021
To be clear, the
println!is a bad idea because we usestdoutfor 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).lenscas commentedon Mar 22, 2021
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_tealworks for me. As for the lua dependencies, you needtlinstalled through luarocks, or just its dependencies and comment out theLoca()version. Then the only tests left are the ones that download it themselves instead of relying on a local install.edwin0cheng commentedon Mar 23, 2021
cc #7954
vallentin commentedon Mar 23, 2021
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.
edwin0cheng commentedon Mar 23, 2021
@vallentin Any error in vscode output ? Because I can't reproduce it in my pc.
vallentin commentedon Mar 24, 2021
@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:
bjorn3 commentedon Mar 24, 2021
Which rustc version are you using?
vallentin commentedon Mar 24, 2021
@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.
lnicola commentedon Mar 27, 2021
That's unexpected, right?
edwin0cheng commentedon Mar 27, 2021
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 ?
vallentin commentedon Mar 27, 2021
@edwin0cheng
From the welcome message:
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 Foocomplained aboutFoonot existing, while thestruct Foowas 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 cleanon Monday, and report back whether the issues stop.itsxaos commentedon Mar 30, 2021
This might not be related to the issue directly, but I was having the same
proc macro server crashedproblem 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
rustceven though I updated all my packages and ranrustup update.I fixed it by running
rustup showto see all the installed toolchains and selecting the newest with:rustup default stable-x86_64-unknown-linux-gnuI ran
cargo cleanjust to be safe and now everything works again.lnicola commentedon Apr 8, 2021
Oh, I just saw this in a project that uses a
rust-toolchainoverride to1.46.edward-shen commentedon Apr 9, 2021
Also seeing this in a project that uses has rust-toolchain
1.46and on aserdederive macro on an Arch Linux install even after acargo clean, so I think it's a platform agnostic issue. I'm unable to reproduce the issue on projects without therust-toolchainfile.lnicola commentedon Apr 9, 2021
So it looks like the metadata format changed at some point without actually changing the version (see #6822 for more details).
edward-shen commentedon Apr 9, 2021
In that case, is the only workaround to right now is to disable proc-macro expansion and wait for a future update?
edwin0cheng commentedon Apr 9, 2021
IIRC, the format changed around 4 months ago, so I think after 1.50 should be fine.
lnicola commentedon Apr 9, 2021
The other workaround is to temporarily remove the
rust-toolchainfile.flodiebold commentedon May 21, 2021
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.
vallentin commentedon May 21, 2021
For what it's worth, I can add that since the 2 months ago, where I commented a somewhat related issue. I did
cargo cleanback then and haven't experienced the issue since.