Skip to content

Readline crashes with ThrowForEmptyQueue #3292

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

Closed
3 tasks done
powercode opened this issue Apr 26, 2022 · 5 comments · Fixed by #3294
Closed
3 tasks done

Readline crashes with ThrowForEmptyQueue #3292

powercode opened this issue Apr 26, 2022 · 5 comments · Fixed by #3294

Comments

@powercode
Copy link
Contributor

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

### Environment
PSReadLine: 2.2.3
PowerShell: 2022.4.2
OS: Microsoft Windows 10.0.19044
BufferWidth: 241
BufferHeight: 18

Last 200 Keys:

 Backspace Ctrl+v Spacebar - m a t c h Spacebar Enter
 Ctrl+@ $ m a t c h e s Enter
 Ctrl+@ UpArrow Enter
 Ctrl+@ UpArrow UpArrow Home RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow Escape Ctrl+v LeftArrow Ctrl+w $ M a t c h e s . v a l u e Enter
 Ctrl+@ UpArrow LeftArrow Backspace Ctrl+w [ Backspace Backspace [ 0 ] Enter
 Ctrl+@ UpArrow LeftArrow UpArrow UpArrow UpArrow UpArrow Home LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow RightArrow End LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Enter
 Ctrl+@ UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Delete RightArrow RightArrow RightArrow RightArrow Delete End Enter
 Ctrl+@ UpArrow UpArrow UpArrow UpArrow DownArrow Enter
 Ctrl+@ $ m a t c e h s Enter
 Ctrl+@ UpArrow Backspace Backspace Backspace h e s Enter
 Ctrl+@ UpArrow UpArrow UpArrow UpArrow Escape i p m o Spacebar - f o r Spacebar b u i Tab Enter
 Ctrl+@ g n o Backspace Backspace m o Spacebar p s r e a d l i

### Exception

System.InvalidOperationException: Queue empty.
   at System.Collections.Generic.Queue`1.ThrowForEmptyQueue()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Screenshot

image

Environment data

PS Version: 7.2.2
PS HostName: Visual Studio Code Host
PSReadLine Version: 2.2.3
PSReadLine EditMode: Windows
OS: 10.0.19041.320 (WinBuild.160101.0800)
BufferWidth: 241
BufferHeight: 18

Steps to reproduce

I was editing this expression when the crash happened:

"6.0.300-preview.22204.3 [asdfo]"| Select-String -Pattern '\d*.\d*.\d*(-\w*\.\d*.\d*.\d*)?' | ForEach-Object { [System.Management.Automation.Seman$_.matches.value ```

### Expected behavior

No crash

### Actual behavior

crash
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Apr 26, 2022
@vojtech-kasny
Copy link

Hi
Same issue here

PS > Get-Module PSReadLine   
                                                                                                                       
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.2.3
PowerShell: 2022.4.2
OS: Microsoft Windows 10.0.22000
BufferWidth: 169
BufferHeight: 19

Last 200 Keys:

 RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow LeftArrow Spacebar | Spacebar S e Ctrl+a Ctrl+c Ctrl+@ Ctrl+c Ctrl+@ Ctrl+c Ctrl+c Ctrl+@ $ c s v Spacebar = Spacebar Ctrl+v Enter
 Ctrl+@ $ c s v [ ] LeftArrow 0 Enter
 Ctrl+@ UpArrow . t a g s Tab Enter
 Ctrl+@ UpArrow Spacebar - r e p l a c e Spacebar Ctrl+v Enter
 Ctrl+@ UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow RightArrow \ RightArrow RightArrow RightArrow \ RightArrow RightArrow \ Enter
 Ctrl+@ Ctrl+c Ctrl+@ c l s Enter
 Ctrl+@ g e t - m o d u Tab Spacebar p s r e Tab

### Exception

System.InvalidOperationException: Queue empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Queue`1.Dequeue()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

@wab80r
Copy link

wab80r commented Apr 27, 2022

Same Issue here. Seems to happen on repeated key presses at the cmd line

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

Environment

PSReadLine: 2.2.3
PowerShell: 2022.4.2
OS: Microsoft Windows 10.0.19042
BufferWidth: 189
BufferHeight: 19

Last 200 Keys:

= Spacebar C o n v e r t - Backspace f r o m - Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace
Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace $ s q l Spacebar Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace $ s l Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab
Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace $ s q l l l Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Tab Backspace Backspace Backspace

Exception

System.InvalidOperationException: Queue empty.
at System.Collections.Generic.Queue1.ThrowForEmptyQueue() at System.Collections.Generic.Queue1.Dequeue()
at Microsoft.PowerShell.PSConsoleReadLine.ReadKey()
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

@daxian-dbw
Copy link
Member

@andschwa @SeeminglyScience, we started to get more reports about the "Queue empty" exception from VSCode recently, and I believe this is due to the ReadLine re-entry issue we are currently looking into.

@SeeminglyScience
Copy link
Contributor

@andschwa @SeeminglyScience, we started to get more reports about the "Queue empty" exception from VSCode recently, and I believe this is due to the ReadLine re-entry issue we are currently looking into.

Yeah I agree 100%. I believe #3294 will fix these as well though.

@ghost ghost added the In-PR A PR is opened targeting the issue label Apr 27, 2022
@ghost ghost added Resolution-Fixed and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. In-PR A PR is opened targeting the issue labels Apr 27, 2022
@ghost
Copy link

ghost commented Apr 27, 2022

🎉 This issue was addressed in 3294, which has now been successfully released in v2.2.4-beta1. 🎉

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

Successfully merging a pull request may close this issue.

5 participants