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

VSCode crash by Go #469

Closed
NhokCrazy199 opened this issue Aug 4, 2020 · 10 comments
Closed

VSCode crash by Go #469

NhokCrazy199 opened this issue Aug 4, 2020 · 10 comments

Comments

@NhokCrazy199
Copy link

Issue Type: Bug

c:\Users\PhamK.vscode\extensions\golang.go-0.16.0\dist\goMain.js:26315
throw err;
^

SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at c:\Users\PhamK.vscode\extensions\766b.go-outliner-0.1.20\out\app.js:187:45
at ChildProcess.exithandler (child_process.js:315:5)
at ChildProcess.emit (events.js:203:13)
at ChildProcess.EventEmitter.emit (domain.js:476:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

Extension version: 0.16.0
VS Code version: Code 1.47.3 (91899dcef7b8110878ea59626991a18c8a6a1b3e, 2020-07-23T13:12:49.994Z)
OS version: Windows_NT x64 10.0.19041

@hyangah hyangah added this to the v0.16.1 milestone Aug 4, 2020
@hyangah
Copy link
Contributor

hyangah commented Aug 4, 2020

@NhokCrazy199 Thanks for the bug report.

It looks like the original exception was from the go-outliner extension (766b.go-outliner).

But the exception from other extension started to affect our extension since Go 0.16.0 release.
I think this is a side-effect of the inlined debug adapter. cc @eliben

The code that threw an error is originated from goDlvDebug.ts:

process.on('uncaughtException', (err) => {
    const errMessage = err && (err.stack || err.message);
    vscode_debugadapter_1.logger.error(`Unhandled error in debug adapter: ${errMessage}`);
    throw err;
});

This is installing a process-wide uncaught exception handler.

It was packed in goMain.js probably because it's using the inlined debug adapter factory.

The dlv dap debug adapter is still in early stages, so I think it's better not to inline.
And when inlining, we should be aware of this process-wide exception handler.

@ivanovishado
Copy link

ivanovishado commented Aug 5, 2020

Hi, @hyangah. Is there any solution? Any way I can help? Is more info needed? Let me know since this same error is happening to me.

I guess this information could be relevant:

- Run `go version` to get version of Go
	- go version go1.12.9 darwin/amd64
- Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders
	- 1.47.3 91899dcef7b8110878ea59626991a18c8a6a1b3e x64
- Check your installed extensions to get the version of the VS Code Go extension 
	- 0.16.0
- Run `go env` to get the go development environment details
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ivan.galaviz/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ivan.galaviz/.gvm/pkgsets/go1.12.9/global"
GOPROXY=""
GORACE=""
GOROOT="/Users/ivan.galaviz/.gvm/gos/go1.12.9"
GOTMPDIR=""
GOTOOLDIR="/Users/ivan.galaviz/.gvm/gos/go1.12.9/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_c/twwltvld2bjgl0k08lt6dq4h0000gn/T/go-build576750648=/tmp/go-build -gno-record-gcc-switches -fno-common"

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/246777 mentions this issue: src/debugAdapter2: launch as an external process, and fix config

@hyangah
Copy link
Contributor

hyangah commented Aug 5, 2020

@ivanovishado thanks! In the mean time, roll back to 0.15.2. Extensions view -> Select "Go" extension -> Click the gear icon -> Install Another Version... -> Choose 0.15.2.

@ivanovishado
Copy link

Thanks, @hyangah!

@hyangah
Copy link
Contributor

hyangah commented Aug 5, 2020

This is not yet released. Since this is a major bug, I will keep this open until it's released and verified.

@hyangah hyangah reopened this Aug 5, 2020
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/246959 mentions this issue: [release] src/debugAdapter2: launch as an external process, and fix config

gopherbot pushed a commit that referenced this issue Aug 5, 2020
…onfig

Eventually we want to inline the debug adapter, but until it gets
more stable and becomes the default adapter, let's launch it
as a separate process to isolate failures. This is handled by the
definition in package.json.

In order to avoid accidental installation of the process-wide
uncaughtException handler when we switch back to the inline mode,
move the handler out of goDlvDebug.ts.

Also, fixes the default configuration provider for delve dap
debug adapter. It should use 'godlvdap' as the type.

Fixes #469
Updates #23

Change-Id: I4df2fff51c703995fd557fe5595a367d7048bd7b
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/246777
Reviewed-by: Polina Sokolova <polina@google.com>
(cherry picked from commit f9c0454)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/246959
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@hyangah
Copy link
Contributor

hyangah commented Aug 5, 2020

RC.1 is out. https://github.com/golang/vscode-go/releases/tag/v0.16.1-rc.1

@NhokCrazy199 @ivanovishado @zhanswift Can you check if the RC1 addresses this issue?
There is a link to the installation instruction. Many many thanks! 🙏

@ivanovishado
Copy link

@hyangah, I installed it and restarted Code several times. No issues so far. 👍

@hyangah
Copy link
Contributor

hyangah commented Aug 6, 2020

Thanks all for verifying the fix. 0.16.1 is released.

@hyangah hyangah closed this as completed Aug 6, 2020
@golang golang locked and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants