Skip to content

rustup show -v could go beyond the defined timeout during Toolchain::rustc_version() #5228

Open

Description

@rami3l

Adapted from the discussion in #5225 (comment):

Currently, rustc_version() issues a rustc subprocess call via child.wait_timeout(Duration::from_secs(10)) and then try to read from child.stdout.unwrap() if the return value is an Ok(Some()).

If a custom rustc wrapper itself spawns a background process inheriting stdout, writes no newline, then exits, wait_timeout returns but read_line can block until the helper writes a newline or closes the pipe. This can hang rustup update or verbose rustup show indefinitely despite the ten-second timeout. Keep stdout collection within the same deadline and handle the case accordingly if no stdout line is available in time.

Further work

  • Extract the read_line logic so that we can also read the first line from child.stderr.unwrap() in case of a non-zero exit code to enrich the error messages.

Activity

  1. self-assigned this
    on Nov 18, 2026
  2. changed the title [-]`rustup show -v` could timeout during `Toolchain::rustc_version()`[/-] [+]`rustup show -v` could go beyond the defined timeout during `Toolchain::rustc_version()`[/+] on Nov 18, 2026
  3. rami3l commented on Nov 18, 2026

    @rami3l
    MemberAuthor

    This is unlikely to happen on official toolchains since create_command() only points to "real" rustc binaries. However linked toolchains can have more flexibility and thus this situation might indeed be possible.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions