deoplete-plugins/deoplete-go

Panics with deoplete-go on Windows

xelra opened this issue · 29 comments

xelra commented

As requested a cross-issue for the deoplete-go side of Panics with deoplete-go on Windows on nsf/gocode.

A quick summary:
gocode -s -debug

2017/02/18 01:26:13 Go project path: hello
2017/02/18 01:26:13 Got autocompletion request for 'C:\Users\xelra\go\src\hello\hello.go'
2017/02/18 01:26:13 Cursor at: 83
panic: runtime error: slice bounds out of range
1(runtime.call32): C:/Go/src/runtime/asm_amd64.s:514
2(runtime.gopanic): C:/Go/src/runtime/panic.go:489
3(runtime.panicslice): C:/Go/src/runtime/panic.go:35
4(main.server_auto_complete): C:/Users/xelra/go/src/github.com/nsf/gocode/server.go:190
5(main.(*RPC).RPC_auto_complete): C:/Users/xelra/go/src/github.com/nsf/gocode/rpc.go:26
6(runtime.call64): C:/Go/src/runtime/asm_amd64.s:515
7(reflect.Value.call): C:/Go/src/reflect/value.go:434
8(reflect.Value.Call): C:/Go/src/reflect/value.go:302
9(net/rpc.(*service).call): C:/Go/src/net/rpc/server.go:387
10(runtime.goexit): C:/Go/src/runtime/asm_amd64.s:2197

go env:

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\xelra\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

Source file:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

While typing this simple "hello world"-file, the errors appear and Neovim locks up for a bit with every character typed.

zchee commented

@xelra Thanks for re-post issue.
And, I have first heard that has been worked Neovim RPC plugin architecture on Windows.
So maybe need to analyze the both of deoplete-go and deoplete core. Please wait a moment...

zchee commented

The sample Go source by @xelra:

package main

import "fmt"

func main() {
	fmt.Printf("hello, world\n")
}

Error log:

2017/02/18 01:26:13 Go project path: hello
2017/02/18 01:26:13 Got autocompletion request for 'C:\Users\xelra\go\src\hello\hello.go'
2017/02/18 01:26:13 Cursor at: 83  # impossible
panic: runtime error: slice bounds out of range
1(runtime.call32): C:/Go/src/runtime/asm_amd64.s:514
2(runtime.gopanic): C:/Go/src/runtime/panic.go:489
3(runtime.panicslice): C:/Go/src/runtime/panic.go:35
4(main.server_auto_complete): C:/Users/xelra/go/src/github.com/nsf/gocode/server.go:190
5(main.(*RPC).RPC_auto_complete): C:/Users/xelra/go/src/github.com/nsf/gocode/rpc.go:26
6(runtime.call64): C:/Go/src/runtime/asm_amd64.s:515
7(reflect.Value.call): C:/Go/src/reflect/value.go:434
8(reflect.Value.Call): C:/Go/src/reflect/value.go:302
9(net/rpc.(*service).call): C:/Go/src/net/rpc/server.go:387
10(runtime.goexit): C:/Go/src/runtime/asm_amd64.s:2197
zchee commented

@xelra As I said, I want to create Windows10 VM and debugging.
So just question:

  • How did you install neovim?
    • Like, In Debian, use apt-get install ...(I don't know Windows package manager) or build from source
    • If you did build from source, Neovim's git commit hash
  • What go runtime version?
    • any stable version or devel
  • Associated Windows environment
    • cygwin? or etc
xelra commented
  • I downloaded the official Neovim for Windows bundle from here. It has Neovim and Neovim-Qt, because TUI doesn't work on Windows yet.
  • go version go1.8 windows/amd64
  • Default Windows environment (no cygwin)
zchee commented

@xelea Thanks detailed. I'm "because TUI doesn't work on Windows yet." is first heard. good reference for me.
I'll try debug with that environment.

Just in case, If you use gocode only(without deoplete-go), does it work?

xelra commented

@zchee I've used gocode in Atom and it works fine there.

Thank you very much for taking the time to make deoplete-go run on Windows.

zchee commented

@xelra Sorry, now I'm in the hospital, so difficult to fix and debug...
I'll check it after the one month. sorry, please wait a moment

xelra commented

@zchee I'm very sad to hear that. Get well soon!

@xelra It is still reproduce-able?

i'm getting gocode panicked in ubuntu 17.10 artful, neovim from repos.

Working now, add to kill gocode before update.

jjuel commented

I am getting deoplete gocode panicked when using completion in Neovim on WSL (Ubuntu Xenial).

I think your gocode is broken.
Please update gocode and gocode close.

jjuel commented

Thanks for your help. I attempted that with no luck. I even attempted completely removing gocode and reinstalling it. Still getting the same error. Not sure what to do at this point.

It is not deoplete-go issue.
Because gocode does not work.

jjuel commented

I am getting the same issue as the OP was. When running gocode -s -debug. gocode seems to think it is a plugin issue. However, I can post this issue on gocode if need be.

2017/11/28 13:17:51 Go project path: github.com/jjuel/ml_with_go/Chapter_6/k-means 2017/11/28 13:17:51 Got autocompletion request for '/mnt/c/Projects/Go/src/github.com/jjuel/ml_with_go/Chapter_6/k-means/main.go' 2017/11/28 13:17:51 Cursor at: 68 2017/11/28 13:17:51 ERROR! Cursor is outside of the boundaries of the buffer, this is most likely a text editor plugin bug. Text editor is responsible for passing the correct cursor position to gocode. panic: runtime error: slice bounds out of range 1(runtime.call32): /usr/local/go/src/runtime/asm_amd64.s:509 2(runtime.gopanic): /usr/local/go/src/runtime/panic.go:491 3(runtime.panicslice): /usr/local/go/src/runtime/panic.go:35 4(main.(*auto_complete_context).apropos): /mnt/c/Projects/Go/src/github.com/nsf/gocode/autocompletecontext.go:349 5(main.server_auto_complete): /mnt/c/Projects/Go/src/github.com/nsf/gocode/server.go:202 6(main.(*RPC).RPC_auto_complete): /mnt/c/Projects/Go/src/github.com/nsf/gocode/rpc.go:26 7(runtime.call64): /usr/local/go/src/runtime/asm_amd64.s:510 8(reflect.Value.call): /usr/local/go/src/reflect/value.go:434 9(reflect.Value.Call): /usr/local/go/src/reflect/value.go:302 10(net/rpc.(*service).call): /usr/local/go/src/net/rpc/server.go:381 11(runtime.goexit): /usr/local/go/src/runtime/asm_amd64.s:2337

Really?
I will test it.
Please provide more information.
It should be another issue.

My environment is Ubuntu 16.04. 17.10 is not installed.

Thanks for your help. I attempted that with no luck. I even attempted completely removing gocode and reinstalling it. Still getting the same error. Not sure what to do at this point.

Please use gocode from the repository.

https://github.com/nsf/gocode

$ go get -u github.com/nsf/gocode
jjuel commented

What more info would you like? And yes I can create another issue if that is necessary. I am using 16.04.3 Xenial, however, it is in the WSL so on Windows 10. Which means my kernel is 4.4.0-43-Microsoft. I have tried just using the gocode from the repo with go get -u github.com/nsf/gocode and still receive these errors. Thank you for all of your help it is greatly appreciated!

I cannot reproduce the problem in Ubuntu 16.04.

Please create the minimal init.vim and the reproduce ways from neovim starting.
The problem must be reproduce-able for other people.

I've similar issue (gocode panic) and I'm on Windows 10 x64 env (had the same error on Win 7 x64).
I'm using the latest Nvim, deoplete-go, deoplete, gocode. The same issue happens with nvim.exe and nvim-qt.exe.
Here's the output of gocode.exe -s -debug (from Win 10 x64 env):

gocode.exe -s -debug
2018/01/31 20:37:42 Go project path: hello
2018/01/31 20:37:42 Got autocompletion request for 'C:\dev\GoProjects\src\hello\hello.go'
2018/01/31 20:37:42 Cursor at: 79
2018/01/31 20:37:42 ERROR! Cursor is outside of the boundaries of the buffer, this is most likely a text editor plugin bug. Text editor is responsible for passing the correct cursor position to gocode.
panic: runtime error: slice bounds out of range
1(runtime.call32): C:/dev/Go/src/runtime/asm_amd64.s:509
2(runtime.gopanic): C:/dev/Go/src/runtime/panic.go:491
3(runtime.panicslice): C:/dev/Go/src/runtime/panic.go:35
4(main.(*auto_complete_context).apropos): c:/dev/GoProjects/src/github.com/nsf/gocode/autocompletecontext.go:349
5(main.server_auto_complete): c:/dev/GoProjects/src/github.com/nsf/gocode/server.go:202
6(main.(*RPC).RPC_auto_complete): c:/dev/GoProjects/src/github.com/nsf/gocode/rpc.go:26
7(runtime.call64): C:/dev/Go/src/runtime/asm_amd64.s:510
8(reflect.Value.call): C:/dev/Go/src/reflect/value.go:434
9(reflect.Value.Call): C:/dev/Go/src/reflect/value.go:302
10(net/rpc.(*service).call): C:/dev/Go/src/net/rpc/server.go:381
11(runtime.goexit): C:/dev/Go/src/runtime/asm_amd64.s:2337

@Hanan-Natan
Please create the new issue.
The minimal init.vim and reproduce instructions are needed.

xelra commented

Yes, this problem is Windows specific. It's not reproducible on Linux.

The connection between gocode and deoplete-go doesn't work on Windows.

gocode itself works well when directly used by plugins in other editors like Atom or Sublime.

I'm sorry I couldn't follow up on this, because I switched to something else.

OK.

I get the reason of the problem.

@xelra Can you test the patch in Windows?

#118 (comment)

xelra commented

I'll try to test this weekend.

Thanks.