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

x/tools/gopls: keeps crashing in VSCode on fresh go installation #66028

Closed
mindbodycode opened this issue Feb 29, 2024 · 8 comments
Closed

x/tools/gopls: keeps crashing in VSCode on fresh go installation #66028

mindbodycode opened this issue Feb 29, 2024 · 8 comments
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@mindbodycode
Copy link

mindbodycode commented Feb 29, 2024

Go version

go1.22.0 windows/amd64, vscode 1.87.0

Output of go env in your module/workspace:

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\skejl\AppData\Local\go-build
set GOENV=C:\Users\skejl\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\skejl\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\skejl\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.0
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\skejl\AppData\Local\Temp\go-build2119327242=/tmp/go-build -gno-record-gcc-switches

What did you do?

Starting my adventure with GO.
Steps taken:

  1. Fresh installation of go
  2. Installed Go extension in vscode
  3. Downloaded and updated go tools
  4. When trying to write and run Hello world I get errors:
    "gopls client: couldn't create connection to server."
    "gopls has crashed, but you are using an outdated version. Please update to the latest version of gopls." - even though it has been freshly updated
    Screenshot 2024-02-29 105514
  5. I disabled all other extensions, cleared my preferences to this:
    {
    "go.toolsManagement.autoUpdate": true
    }
    The issue remains.

What did you see happen?

[Error - 10:54:58 AM]
[Error - 10:54:58 AM] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
at GoLanguageClient.shutdown (c:\Users\skejl.vscode\extensions\golang.go-0.41.1\dist\goMain.js:21886:17)
at GoLanguageClient.stop (c:\Users\skejl.vscode\extensions\golang.go-0.41.1\dist\goMain.js:21863:21)
at GoLanguageClient.stop (c:\Users\skejl.vscode\extensions\golang.go-0.41.1\dist\goMain.js:22699:22)
at GoLanguageClient.handleConnectionError (c:\Users\skejl.vscode\extensions\golang.go-0.41.1\dist\goMain.js:22104:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Error - 10:54:58 AM] gopls client: couldn't create connection to server.
Message: write EPIPE
Code: -32099
Error starting language server: Error: write EPIPE[Error - 10:54:59 AM]

What did you expect to see?

I expected to run first "Hello World"

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Feb 29, 2024
@seankhliao seankhliao changed the title gopls keeps crushing in VSCode on fresh go installation, can't run my first HelloWorld x/tools/gopls keeps crushing in VSCode on fresh go installation, can't run my first HelloWorld Feb 29, 2024
@seankhliao seankhliao changed the title x/tools/gopls keeps crushing in VSCode on fresh go installation, can't run my first HelloWorld x/tools/gopls: keeps crashing in VSCode on fresh go installation Feb 29, 2024
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Feb 29, 2024
@gopherbot gopherbot added this to the Unreleased milestone Feb 29, 2024
@suzmue
Copy link
Contributor

suzmue commented Feb 29, 2024

What version of gopls are you experiencing this issue with? gopls -v version on the command line.

@suzmue suzmue added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 29, 2024
@mindbodycode
Copy link
Author

gopls v0.15.1

@findleyr
Copy link
Contributor

findleyr commented Mar 4, 2024

@mindbodycode could you look in Output->gopls (server) to see if there is a gopls crash reported?

@mindbodycode
Copy link
Author

mindbodycode commented Mar 4, 2024

@findleyr today I reinstalled and updated it once again. Finally gopls stopped crushing. Now when running my first hello world it doesn't run and I get: "fork/exec C:\Users\skejl\AppData\Local\Temp\go-build351412623\b001\exe\main.exe: The parameter is incorrect."
Tried googling it, but still could not find a solution

@adonovan
Copy link
Member

adonovan commented Mar 7, 2024

Happy to hear reinstalling fixed the problem.

Regarding the second issue, could you describe the steps you took? (It looks like you ran "go run", perhaps?)

That error message ("the parameter is incorrect") is strange: as far as I can tell, it is most commonly associated with external storage devices. Do you have any anti-virus software installed? They can often modify the behavior of the file system.

@mindbodycode
Copy link
Author

mindbodycode commented Mar 9, 2024

@adonovan thank you for pointing me into right direction. Finally it works correctly.

What helped in my case:

  1. I removed all go and go vscode extension.
  2. Uninstalled firewall and antivirus.
  3. Installed go and vscode go extension.
  4. Updated go and vscode go extension and the rest go vscode tools.
  5. Installed antivirus and firewall and added these exceptions:
    C:\Program Files\Go*
    C:\Users\ YOUR USERNAME \go* --> directory depending on your GOPATH
    C:\Users\ YOUR USERNAME \AppData\Local\Temp\go-build*\b*\exe*.exe
  6. Now all works fine

Thank you everyone for your support!

@adonovan
Copy link
Member

adonovan commented Mar 9, 2024

I'm curious to know whether removing the antivirus exceptions causes the original bug to recur.
Also, what AV software are you using? We should make a note in case we encounter this again. AV software as a category has an appalling track record for file system bugs and especially serious performance regressions.

Glad you got things working!

@mindbodycode
Copy link
Author

mindbodycode commented Mar 9, 2024

Removing the exceptions resulted in error in terminal:
"fork/exec C:\Users\skejl\AppData\Local\Temp\go-build2274897758\b001\exe\main.exe: Access is denied."
So it's a bit different then the previous one:
":The parameter is incorrect."

Avast is the name of the AV "culprit". What was surprising is that on initial error there was no message nor prompt from avast that there is a threat (both when I was testing with and without behavior shields).
Now after the reinstallation the enclosed alarm appears:
Screenshot 2024-03-09 202851

My main.go which I tested with "go run main.go" in vscode was just a simple hello world:):
package main

import "fmt"

func main() {
fmt.Println("hello world adfasdfas")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants