Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to write request: Broken pipe (os error 32)rust-analyzermacro-error #10766

Closed
kulame opened this issue Nov 14, 2021 · 19 comments · Fixed by #10769
Closed

failed to write request: Broken pipe (os error 32)rust-analyzermacro-error #10766

kulame opened this issue Nov 14, 2021 · 19 comments · Fixed by #10769

Comments

@kulame
Copy link

kulame commented Nov 14, 2021

/// Instructions supported by the generic Name Registry program
#[derive(Clone, BorshSerialize, BorshDeserialize, PartialEq)]
pub enum AggregatorInstruction {
    /// Accounts:
    ///   0. [writable] The aggregator to initialize
    ///   1. [sign] Owner
    ///   2. [] Rent sysvar
    ///   3. [] Clock sysvar
    Initialize(Config),
    /// Accounts:
    ///   0. [writable] The aggregator
    ///   1. [sign] Oracle
    ///   2. [] Clock sysvar
    Submit { timestamp: Timestamp, value: Value },
}

it show some error

failed to write request: Broken pipe (os error 32)rust-analyzermacro-error
failed to write request: Broken pipe (os error 32)rust-analyzermacro-error
@bjorn3
Copy link
Member

bjorn3 commented Nov 14, 2021

Just to confirm. Are those proc macros from the borsh crate?

@kulame
Copy link
Author

kulame commented Nov 14, 2021

yep, it used borsh

@yotamofek
Copy link
Contributor

This is breakage probably caused by the merging of this PR: rust-lang/rust#87264
I'm guessing it has to do with being on the latest rustc nightly rather than a specific crate's proc macros :)

@kulame
Copy link
Author

kulame commented Nov 14, 2021

TvT

@bjorn3
Copy link
Member

bjorn3 commented Nov 14, 2021

@alexjg
Copy link
Contributor

alexjg commented Nov 14, 2021

I'll sort it out tomorrow!

@qm3ster
Copy link

qm3ster commented Nov 14, 2021

idk if tomorrow means fix will ship this Monday or next, but to whomst'd've it may've concerned, the temporary fix is:

rustup default nightly-2021-11-12

to undo:

rustup default nightly
rustup uninstall nightly-2021-11-12

(obviously not hurrying anyone anywhere, btw)

@kulame
Copy link
Author

kulame commented Nov 15, 2021

great!!!

@Sword-Smith
Copy link

Having the same problem in VS Code with rust-analyzer. Will prefer to stay on stable and not upgrade to nightly, so there is no fix for me yet.

@qm3ster
Copy link

qm3ster commented Nov 23, 2021

@Sword-Smith we were downgrading the nightly, and that has since been resolved in #10769 and released yesterday.
We can all return to the current nightly now.
If you are currently having a problem with stable rustc, which is 1.56.1, it's either a regression for the old ABI or an unrelated problem altogether.

Please make sure:

  1. you rustup update your stable
  2. Ctrl-Shift-P > Rust Analyzer: Show RA Version shows rust-analyzer version: 183ef048f 2021-11-22 stable (that's the actual rust-analyzer binary that the matklad.rust-analyzer VS Code extension downloads separately). If not, close all your VS Code windows, it will try to update on next open.
  3. cargo clean your project

and then post the particular error you are getting.

@Sword-Smith
Copy link

Sword-Smith commented Nov 23, 2021

1. you `rustup update` your stable

2. Ctrl-Shift-P > Rust Analyzer: Show RA Version shows `rust-analyzer version: 183ef048f 2021-11-22 stable` (that's the actual rust-analyzer binary that the `matklad.rust-analyzer` VS Code extension downloads separately). If not, close **all** your VS Code windows, it will try to update on next open.

3. `cargo clean` your project

I went through all your steps but had to add another one, even though VS Code showed the version you described in step 2:

  1. Close all VS Code windows and open them again.

Edit: I took the liberty to post this on Stack Exchange as there is there are too few Rust questions on Stack Exchange: https://stackoverflow.com/questions/70079983/rust-analyzer-failed-to-write-request-broken-pipe-os-error-32/70079984

@ErwanDL
Copy link

ErwanDL commented Nov 23, 2021

Just encountered the same problem as @Sword-Smith, I believed it happened just after I updated to the latest version of VSCode. I ran rustup update and then quit VSCode and restarted it and the error messages went way (not sure if the rustup update was necessary or if fully restarting VSCode would have sufficed).

@alexjg
Copy link
Contributor

alexjg commented Nov 23, 2021

Unfortunately this error message is fairly general and will be caused by many different scenarios. I'm fairly sure the code posted in this issue no longer causes the problem. If you're experiencing a problem I think the best way to proceed would be to open a new issue with your rust-analyzer and rustc versions and a sample of code which causes the problem, it's much easier to diagnose the problem that way.

@Voronar
Copy link

Voronar commented Nov 24, 2021

Same issue with vscode rust-analyzer v0.2.826.

rustup 1.24.3 (ce5817a94 2021-05-31)
info: The currently active `rustc` version is `rustc 1.54.0 (a178d0322 2021-07-26)`

Updating Rust version is not a variant in my case. I installed previous working ra binary (https://github.com/rust-analyzer/rust-analyzer/releases/tag/2021-11-08).

@taylorlee
Copy link

I also encountered [rust-analyzer macro-error] [E] failed to write request: Broken pipe (os error 32) when using rust-analyzer d9b2291f5 2021-11-29 stable via coc-rust-analyzer v0.56.0, but only on codeblocks using derive(StructOpt) https://docs.rs/structopt/0.3.25/structopt/index.html#how-to-derivestructopt on a project that had pinned the rust-toolchain to 1.54.0. Upgrading the toolchain to 1.56.1 fixed the issue for me.

@rahul-soshte
Copy link

rahul-soshte commented Dec 1, 2021

I also encountered this error. My system was VSCode + WSL. I made a mistake of using WSL on Windows FileSystem, but then I came to know about the Remote-WSL extension. I switched VSCode to Ubuntu 20.04 filesystem(WSL) and then error was no more. Weird things happen if VSCode is used on Windows Filesystem.

I referred this link for getting the Extension idea. Follow this if you are using WSL + VSCode: https://harsimranmaan.medium.com/install-and-setup-rust-development-environment-on-wsl2-dccb4bf63700

Edit 2/12/2021: I think using / not using Windows Filesystem doesn't make a difference and using Remote WSL Extension may fix nothing
This is how I resolved it

  1. Uninstalled rust-analyzer extension v0.2.834 (latest)
  2. did rustup update and rustup default nightly
    Current rustc version rustc 1.59.0-nightly (48a5999fc 2021-12-01)
  3. Installed RA version 0.2.826 (1 version prior), still didnt work, uninstalled it
  4. Installed RA Version 0.2.817 (2 versions prior)
  5. Restarted VSCode, everything worked.

Also I am using a macro which uses proc macro (borsh) under the hood

@GalvinGao
Copy link

1. you `rustup update` your stable

2. Ctrl-Shift-P > Rust Analyzer: Show RA Version shows `rust-analyzer version: 183ef048f 2021-11-22 stable` (that's the actual rust-analyzer binary that the `matklad.rust-analyzer` VS Code extension downloads separately). If not, close **all** your VS Code windows, it will try to update on next open.

3. `cargo clean` your project

I went through all your steps but had to add another one, even though VS Code showed the version you described in step 2:

  1. Close all VS Code windows and open them again.

Edit: I took the liberty to post this on Stack Exchange as there is there are too few Rust questions on Stack Exchange: stackoverflow.com/questions/70079983/rust-analyzer-failed-to-write-request-broken-pipe-os-error-32/70079984

For me another key step was to ensure the rustc version you are using is actually the one that is provided by rustup. I ended up using a Homebrew installation of my rust toolchain and it has a higher precedence in my PATH and in result I'm using a more older rust toolchain, specifically rustc 1.54.0.

Check using which rustc gives me /usr/local/bin/rustc, which clearly isn't where rustup is installing the toolchain to. By using brew uninstall rust and cargo clean then cargo run everything now works like a charm! ❤️

@gpeacock
Copy link

  1. Installed RA Version 0.2.817 (2 versions prior)
  2. Restarted VSCode, everything worked.

I tried all the other steps and reverting to an older version of the plugin was the only thing that worked for me. I don't want to stop using RA, so I'll stay on this version until this issue gets resolved.

@syddo
Copy link

syddo commented Dec 24, 2021

Hi. I'm still seeing this error in v0.2.853 when using the crate https://crates.io/crates/builder-pattern with just the example code.

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

Successfully merging a pull request may close this issue.