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

When upgrading from PSReadLine 2.1 to 2.2, Pasting on remote machines gets slow towards end #3879

Open
3 tasks done
wonkifier opened this issue Nov 23, 2023 · 4 comments
Open
3 tasks done
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention 👋

Comments

@wonkifier
Copy link

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

SlowPaste220b5.mov

Environment data

PS Version: 7.3.9
PS HostName: ConsoleHost
PSReadLine Version: 2.2.0-beta5
PSReadLine EditMode: Emacs
OS: Linux <redacted> 3.10.0-1160.99.1.el7.x86_64 #1 SMP Thu Aug 10 10:46:21 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
BufferWidth: 176
BufferHeight: 62

I first observed this on PSReadLine 2.2.6 (as part of a default Powershell 7.3.9 install), but tested with current version, and then tested back to 2.2.0-beta5.
2.2.0-beta4 pasted normally (everything in one shot, no slowdown for latter portion of paste)

Something changed from beta4 to beta5 that causes this

Steps to reproduce

#- Create a text file/window with the following sample contents to copy from

&{

  Write-Host "Test line"
  Write-Host "Test line"
  Write-Host "Test line"
  Write-Host "Test line"
  Write-Host "Test line"
  • From my local Mac running Terminal.app, SSH into the RHEL 8 host in a bash shell
  • run pwsh
  • Copy the text from the file above and paste into the window
  • Observe that the first portion of the paste is instant, then the latter portion appears as if it's being type out by hand
  • Press Ctrl-C to get back to a regular prompt

Steps I used to change version of PSReadline:

  • While logged into remote bash session:
pwsh -noprofile -command "Uninstall-Module PSReadLine"
pwsh -noprofile -command "Install-Module PSReadLine -Force -SkipPublisherCheck -RequiredVersion 2.2.0-beta4 -AllowPrerelease"
pwsh
get-module psreadline # to confirm the installed version

Expected behavior

The entire contents of the past should be "instant", no slowdown at the end.

Actual behavior

Refer to attached video... The first portion of the paste is instant, then the latter portion appears as if it's being typed out by hand

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Nov 23, 2023
@StevenBucher98
Copy link
Collaborator

Looks like your video may have been cut off as its <1 second for me, however I dont seem to have slow pasting on my Mac PSReadLine version 2.3.4, can you see if 2.3.4 also has this issue? Perhaps there is some delay since you are remoting in?

@StevenBucher98 StevenBucher98 added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author Feedback and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Nov 28, 2023
@wonkifier
Copy link
Author

Same behavior on 2.3.4.

It can't be just a matter of being a remote connection alone, because it works fine on 2.2.0-beta4 and earlier.

Also, if it were a relatively consistent delay through the entire paste, I could see that as being "remote" caused. But that's not the case. It's "first chunk = full speed" followed by "last several characters one at a time"

But the behavior I'm seeing isn't that.
When I paste the above text, it all goes instantly in one chunk ending with Write-Host "Tes of the last line. Then I see the letter t show up, Then a space, then an l, then an i, then an n, then an e, then a quote.

And if I copy/paste the lines so there are 50 lines instead of 5, it's the same exact behavior... all lines go instantly until after the Tes of the final line, then it finishes one character at a time.
If I extend it to 500 lines, the only difference is what you'd expect when pasting that much text... a couple screenfuls instantly, a pause, some more screenfuls, pause... until that last Tes, after which it completes 1 character at a time.

Every published version from 2.2.0-beta5 has this behavior. No published version before it has it.

Not sure what the deal is with the video... if you right-click to download it and you view it locally does it also get stuck at the first frame?

@wonkifier
Copy link
Author

I've tried to test the exact scenario locally (without a remote host) but I can't replicate it exactly on my M1 Mac.

If I use the same docker image with Powershell 7.3 or above, it fails because of .Net incompatibility with Rosetta.
If I run Powershell 7.2, I can't get it accept newer versions of PSReadLine

And if I build a container locally that doesn't require rosetta, it works fine and snappily... except since it's not running on a different platform, I can't rule out the "remote" angle, since I'd need the same platform on both sides.
And I don't have a remote aarch64/arm64 host to try the same image on.

@wonkifier
Copy link
Author

I was able to track down a Windows host where I could install Docker and run the same image, and I didn't see the "instant start, slow finish" behavior. So this does seem like something that changed between 2.2.0-beta4 and 2.2.0-beta5 impacted remote session behavior.

I just tested is in iTerm2 on my Mac, so it's not Terminal.app specific. I don't have a handy remote host other than RHEL8 based to test with, so I don't know if it's sensitive to Linux distro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention 👋
Projects
None yet
Development

No branches or pull requests

2 participants