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

Debugger crashes after multiple runs. #273

Closed
antonyoni opened this issue Aug 30, 2016 · 12 comments
Closed

Debugger crashes after multiple runs. #273

antonyoni opened this issue Aug 30, 2016 · 12 comments
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@antonyoni
Copy link

Versions:
VSCode: 1.4.0
OS: Windows 10.1607
Extension: 0.7.1

After running the debugger multiple times, there is a 'powershell has stopped working' error:
vscode-error-3
and the following in the Console:

[Extension Host] Uncaught Exception:  Error: read ECONNRESET
[Extension Host] Error: read ECONNRESET
    at exports._errnoException (util.js:890:11)
    at TCP.onread (net.js:552:26)
read ECONNRESET: Error: read ECONNRESET
    at exports._errnoException (util.js:890:11)
    at TCP.onread (net.js:552:26)
[Extension Host] powershell.exe terminated with exit code: 2
[Extension Host] rejected promise not handled with 1 second
This socket is closed.: Error: This socket is closed.
    at Socket._writeGeneric (net.js:648:19)
    at Socket._write (net.js:700:8)
    at doWrite (_stream_writable.js:301:12)
    at writeOrBuffer (_stream_writable.js:287:5)
    at Socket.Writable.write (_stream_writable.js:215:11)
    at Socket.write (net.js:626:40)
    at StreamMessageWriter.write (C:\Users\Antony\.vscode\extensions\ms-vscode.PowerShell-0.7.1\node_modules\vscode-jsonrpc\lib\messageWriter.js:22:23)
    at C:\Users\Antony\.vscode\extensions\ms-vscode.PowerShell-0.7.1\node_modules\vscode-jsonrpc\lib\main.js:195:31
    at Object.connection.sendRequest (C:\Users\Antony\.vscode\extensions\ms-vscode.PowerShell-0.7.1\node_modules\vscode-jsonrpc\lib\main.js:186:20)
    at Object.result.shutdown (C:\Users\Antony\.vscode\extensions\ms-vscode.PowerShell-0.7.1\node_modules\vscode-languageclient\lib\main.js:48:51)

Once this happens I get a 'Debuger adapter process has terminated unexpectedly' error when debugging further:
vscode-error-2

This issue occurs on two separate machines with the same versions of everything. Only started happening after update to extension version 0.7.1.

Can be fixed by restarting vscode.

@daviwil
Copy link
Contributor

daviwil commented Aug 30, 2016

Hey @antonyoni, can you zip up the following folder and e-mail it to me, daviwil [at] microsoft.com:

$HOME\.vscode\extensions\ms-vscode.PowerShell-0.7.1\logs

Thanks!

@daviwil
Copy link
Contributor

daviwil commented Aug 30, 2016

Could be related to this issue: #243

@gpuido
Copy link

gpuido commented Aug 31, 2016

I experience the same bug, I'll send you my logs.

@antonyoni
Copy link
Author

I've just sent the logs. I also noticed some strange behaviour where not all expected output is showing in the Debug Console. If I run the following:

Write-Host "line 1"
#Write-Warning "warning 1"
#Write-Error "error 1"
Write-Host "line 2"

I get nothing in the output console. Uncommenting the warning still produces nothing. If the warning and error are uncommented, then I get everything including the error, but not "line 2". Stdout not getting flushed?

I don't think this was happening with 0.6.1.

Not sure if it's related to PowerShellEditorServices#138

@rkeithhill
Copy link
Contributor

rkeithhill commented Aug 31, 2016

@antonyoni I've seen this as well on 0.7.1. If you set a breakpoint on line 1 and step over it, you'll see its output. But when you step over the last line, you probably won't - at least I don't. Seems like a flushing issue as you will see the outputting while stepping but if the script executes fast enough, there is no output.

@alex-hempel
Copy link

I'm experiencing the same issue on the same config, although it's been like that for me since 0.7.0.

@daviwil
Copy link
Contributor

daviwil commented Sep 1, 2016

Thanks for sending your logs, guys, I am looking at them now.

@antonyoni: You're right, the output issue is related to the one you found. Need to investigate that as well.

@daviwil
Copy link
Contributor

daviwil commented Sep 1, 2016

I think I fixed the problem! Filed an issue on the PowerShellEditorServices repo to track it: PowerShell/PowerShellEditorServices#284

New release with the fix within 24 hours!

daviwil added a commit to PowerShell/PowerShellEditorServices that referenced this issue Sep 2, 2016
This change fixes an issue in PowerShellContext.AbortException which
causes it to throw a NullReferenceException when called after the session
has already been aborted.  This issue manifests sometimes when the
debug adapter finishes execution normally or when it terminates due to a
script parsing error.  It was initially reported in the following two
issues for the PowerShell VS Code extension:

PowerShell/vscode-powershell#243
PowerShell/vscode-powershell#273

The fix is to check whether the PowerShellContext.SessionState is Aborted
or Disposed before proceeding with the abort.
@bughit
Copy link

bughit commented Sep 2, 2016

Why isn't 0.6.2 on the releases page?

@daviwil
Copy link
Contributor

daviwil commented Sep 2, 2016

Sometimes I just forget to do it :/ For this release I'm going to put together a script to automate the release uploads on GitHub so that they're always available.

@antonyoni
Copy link
Author

@daviwil that's fixed it - haven't had to restart vscode yet today. thanks!

@daviwil
Copy link
Contributor

daviwil commented Sep 3, 2016

Excellent, thanks a lot for confirming! Please let me know if you hit another crash, I've added some additional logging which should help diagnose future issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

6 participants