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

posh extension crashing on debian linux #1283

Closed
SolidCore-IA opened this issue Apr 22, 2018 · 21 comments · Fixed by PowerShell/PowerShellEditorServices#730
Closed

posh extension crashing on debian linux #1283

SolidCore-IA opened this issue Apr 22, 2018 · 21 comments · Fixed by PowerShell/PowerShellEditorServices#730

Comments

@SolidCore-IA
Copy link

SolidCore-IA commented Apr 22, 2018

Issue Description

I am experiencing a problem were the powershell extension keeps crashing on Debian 9.4 linux. Error is "The powershell session has terminated due to an error, would you like to restart it?". I thought at first it was because of the integrated terminal, but I disabled the integrated terminal to auto-start. It happens with all ps1 or psm1 files when I open them or if I try to add a function using the auto-fill menu for powershell functions.
Restarting the extension, disable/enable, and reinstalled the extension same issue.

Attached Logs

Follow the instructions in the README about
capturing and sending logs.
logs.zip

Environment Information

Visual Studio Code

Name Version
Operating System Linux x64 4.9.0-6-amd64
VSCode 1.22.2
PowerShell Extension Version 1.6.0

PowerShell Information

Name Value
PSVersion 6.1.0-preview.1
PSEdition Core
GitCommitId v6.1.0-preview.1
OS Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02)
Platform Unix
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.1.0-preview.1
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
arc-plus ph-hawkins 1.0.1
nord-visual-studio-code arcticicestudio 0.6.0
path-intellisense christian-kohler 1.4.2
PowerShell ms-vscode 1.6.0
python ms-python 2018.3.1
reg ionutvmi 0.0.2
vscode-github KnisterPeter 0.27.1
@TylerLeonhardt
Copy link
Member

Hi there, thanks for this report. We'll take a look! I just want to say that if you delete the integrated terminal, you basically get rid of all the good features of the extension (rich intellisense, script analyzer squiggles, the ability to run something with F8)

Can you do me a favor and set your logs to Diagnostic? This will give us a 3rd log that I'm interested in. Just attach the zip of all 3 logs when the error occurs.

We'll figure this out 😀

@SolidCore-IA
Copy link
Author

I only disabled it because I thought the issue was with the integrated terminal loading powershell (really didnt want to). I noticed testing just now (with the terminal still disabled) I can produce the error when I type "function" it pulls up the intellisense/auto-complete menu for function. When I select the "function template" then the extension will error right after it pastes in my script. here is the new logs

logs.zip

@TylerLeonhardt
Copy link
Member

Is this the setting you changed?:
"powershell.integratedConsole.showOnStartup": false

I'm having a hard time reproducing this.

Just curious, what do you get if you don't disable the integrated terminal?

@SolidCore-IA
Copy link
Author

SolidCore-IA commented Apr 29, 2018

yes that is what I changed. The issue started with the integrated console on. I turned it off only to troubleshoot.

I tested just now and noticed my powershell extension updated, but same issue still.

edit: My goal is to edit powershell files on my linux workstation and then push them to a windows lab.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented May 2, 2018

So the extension still crashes... Can you send me the log of it crashing without you disabling the integrated console? The error might look the same but the underlying exception might give a better idea.

The logs that you provided so far are good, but they seem to only tell me it crashes when you kill the integrated console.

Sorry to keep asking you that.

Also what version of Debian? I'll spin up a VM and give it a try to repro.

@SolidCore-IA
Copy link
Author

OS: Debian GNU/Linux 9.4 (stretch) x86_64
Kernel: 4.9.0-6-amd64

I will get you the logs today

@SolidCore-IA
Copy link
Author

SolidCore-IA commented May 3, 2018

Logs as requested below. I did the diag logs and not verb; hope that was right.
So, I open a posh profile file, the integrated console opened, it did a bunch of verbose stuff in the console, then I stepped away for a minute, and came back to the error and the crash. Told the extension to restart and then it crashed again. I didnt even touch the file itself in vscode.

vscodelogs.zip

@rkeithhill
Copy link
Contributor

In the one log it looks like PSSA came back with 4 violations:

  • The cmdlet 'check-module' uses an unapproved verb. (PSUseApprovedVerbs)
  • The variable 'pscr' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)
  • The variable 'logdir' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)
  • The variable 'desk' is assigned but never used. (PSUseDeclaredVarsMoreThanAssignments)

Then a code action was invoked. Looks like PSES read the message, returned an empty result message and then there was no more output - hard crash. Do you remember which code fix you invoked in this case?

@SolidCore-IA
Copy link
Author

SolidCore-IA commented May 10, 2018

Sorry, code fix?
I can open that same ps1 profile in vscode (all the same extensions) on a windows 7 x64 workstation w/ posh v5.1 installed; no crashes like on my debian workstation. I am aware of those "violations" but they dont cash my extenstion on windows. Is this an issue with posh v6 on my linux?

edit: Later today, I will remove those issues and try again.

@rjmholt
Copy link
Contributor

rjmholt commented Jul 31, 2018

@SolidCore-IA are you still experiencing this crash?

@SolidCore-IA
Copy link
Author

yes I am still having this issue. With a fully update debian 9.5, vscode, and powershell core.

@SolidCore-IA
Copy link
Author

tested today with a blank .ps1 file and still getting crashes from the powershell plug-in. A bunch of fresh logs attached. At this point I cant work with powershell files and the powershell plug-in at the same time at all.
logs.zip

@rkeithhill
Copy link
Contributor

rkeithhill commented Aug 22, 2018

Thanks for attaching the logs. I can now repro this issue (on Windows). Essentially, create an Untitled-1 file, paste in the following text:

testS\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n

Convert \n to newlines, set the editor file type to PowerShell, then go to the end of the press, press enter a few times and then back space the same number. That caused the same exception for me:


    System.AggregateException: One or more errors occurred. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: Position 343:1 is outside of the line range of 1 to 342.
       at Microsoft.PowerShell.EditorServices.ScriptFile.ValidatePosition(Int32 line, Int32 column)
       at Microsoft.PowerShell.EditorServices.ScriptFile.ApplyChange(FileChange fileChange)
       at Microsoft.PowerShell.EditorServices.Protocol.Server.LanguageServer.HandleDidChangeTextDocumentNotification(DidChangeTextDocumentParams textChangeParams, EventContext eventContext)

Possibly related - microsoft/PTVS#4350

Update: It seems to crash on the second backspace from the end of the file.

@SolidCore-IA
Copy link
Author

I get this crash on any powershell script or module. The /n lines were just me waiting for it to crash. It happens with in 60 secs of what I think is the powershell extensions loading on any posh file.

@rjmholt
Copy link
Contributor

rjmholt commented Aug 22, 2018

This looks like it might be related to #1492

@rjmholt
Copy link
Contributor

rjmholt commented Aug 22, 2018

Also this one: #1453

@rjmholt
Copy link
Contributor

rjmholt commented Aug 23, 2018

I've just realised the commonality in all these issues is adding a new line to the end of the file -- there seems to be an off-by-one problem there. Seems related to PowerShell/PowerShellEditorServices#573 maybe?

@rjmholt
Copy link
Contributor

rjmholt commented Aug 23, 2018

Think I've got a fix for this one now -- see the PR above

@SolidCore-IA
Copy link
Author

I guess Im a little confused. How do I obtain this fix? Wait for the next extension release?

@TylerLeonhardt
Copy link
Member

Yeah we're planning on doing a release this week.

@SolidCore-IA
Copy link
Author

I have the update on the extension and still crashing. It crashes with a blank .ps1 file open. All new logs attached; including the blank .ps1 file I created only to test this.
morelogs.zip

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