Skip to content

"An existing connection was forcibly closed by the remote host." error on Windows (with Rust + MSVC) #1186

Open

Description

@skyfallwastaken

When I try to build my Rust project, I get this error:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `C:\Users\Mahad\.cargo\bin\sccache.exe rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 2)
  --- stderr
  sccache: error: failed to execute compile
  sccache: caused by: Failed to send data to or receive data from server
  sccache: caused by: An existing connection was forcibly closed by the remote host. (os error 10054)

Restarting the server/machine/VS Code did not help. In addition to this, Kaspersky's Web Anti-Virus is turned off.

Activity

  1. emabrey commented on Aug 18, 2022

    @emabrey
    Contributor

    OS error 10054 indicates the peer application reset the TCP connection (set the TCP RST flag). That could be from improper firewall configuration, spotty wifi, etc.

    As it is right now I don't have enough information to determine if this is a bug in sccache, or if you simply had a transient networking issue.

    Can you provide more information about your network environment and what you were trying to compile? Also, if you could provide your windows version that would also be helpful.

  2. skyfallwastaken commented on Aug 26, 2022

    @skyfallwastaken
    Author

    Hello, thanks for the reply!

    • My network is pretty stable (~40Mbps)
    • I was trying to compile a Tauri project I think? (can't remember)
    • I was using local disk storage
    • I'm using Windows version 10.0.19044.1889
  3. emabrey commented on Aug 27, 2022

    @emabrey
    Contributor

    Can you provide the rust toolchain you are using?

    rustup toolchain list is the command

  4. skyfallwastaken commented on Sep 10, 2022

    @skyfallwastaken
    Author

    I can't remember (I switched away from Windows to Linux) but I'm pretty sure it was the latest stable Rust version at the time.

  5. wmmc88 commented on Oct 31, 2023

    @wmmc88

    I also run into this issue occasionally on windows with only a local disk cache.

    sccache: error: failed to execute compile
    sccache: caused by: Failed to send data to or receive data from server
    sccache: caused by: An existing connection was forcibly closed by the remote host. (os error 10054)
    

    Sometimes I use sccache stop-server and sccache start-server to try to restart the server, but most of the time, the issue is not resolved and I have to resort to resetting RUSTC_WRAPPER

  6. PrototypeNM1 commented on Jan 7, 2025

    @PrototypeNM1
    Contributor

    Had the same behavior. Deleting the target directory (not via cargo clean) resolved the issue.

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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions