Skip to content

Slow Powershell startup due to PSReadLine #3192

@gerardog

Description

@gerardog

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

N/A

Screenshot

Hi! This was reported as #2143, but somehow marked as a question instead of a bug, then closed.

When using my Android phone as a wifi hotspot, W11, Powershell Core (7.2.1) with PSReadLine 2.1.0 takes 15 seconds to start.

I disabled all PS telemetry as shown here, rebooted, but the problem still persists. The problem goes away when running pwsh -NonInteractive and can be then reproduced (15 seconds delay) at 'Import-Module PSReadLine'

C:\>pwsh
PowerShell 7.2.1
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.
<!-- 15 seconds delay! -->

PS C:\> exit

C:\>pwsh -noninteractive
PowerShell 7.2.1
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

<!-- fast! no delay ! -->

PS C:\> Measure-Command {Import-Module PSReadLine}
(...)
TotalSeconds      : 15.0726826

During this wait, TCPView shows

image

ipconfig /displaydns shows a lot of stuff but certaintly ctldl.windowsupdate.com and fg.download.windowsupdate.com.c.footprint.net rings a bell (same IP).

PS C:\Users\gerar> ipconfig /displaydns
(...)

    ctldl.windowsupdate.com
    ----------------------------------------
    Record Name . . . . . : ctldl.windowsupdate.com
    Record Type . . . . . : 5
    Time To Live  . . . . : 41
    Data Length . . . . . : 8
    Section . . . . . . . : Answer
    CNAME Record  . . . . : wu-shim.trafficmanager.net

    Record Name . . . . . : wu-shim.trafficmanager.net
    Record Type . . . . . : 5
    Time To Live  . . . . : 41
    Data Length . . . . . : 8
    Section . . . . . . . : Answer
    CNAME Record  . . . . : fg.download.windowsupdate.com.c.footprint.net

    Record Name . . . . . : fg.download.windowsupdate.com.c.footprint.net
    Record Type . . . . . : 1
    Time To Live  . . . . : 41
    Data Length . . . . . : 4
    Section . . . . . . . : Answer
    A (Host) Record . . . : 200.32.103.248

It is possible that my ISP is doing something bad, but the point here is that PSReadline shouldnt be taking so long to start anyway. If this an auto-update feature, can be disabled? can occur in background?

Thanks!

Environment data

PS Version: 7.2.1
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.1.0
PSReadLine EditMode: Windows
OS: 10.0.22000.1 (WinBuild.160101.0800)
BufferWidth: 133
BufferHeight: 32

Steps to reproduce

Use a terrible ISP. An Android hotspot may help. Open Pwsh and then see how it takes 15 seconds to show a PS prompt.

Expected behavior

Fast start time

Actual behavior

Import-Module PSReadLine takes 15 seconds.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions