go-lang-plugin-org / go-lang-idea-plugin

Google Go language IDE built using the IntelliJ Platform
https://plugins.jetbrains.com/plugin/5047
Other
4.57k stars 573 forks source link

cannot stop debugger: "could not deliver signal: operation not permitted" #2064

Open bald2b opened 8 years ago

bald2b commented 8 years ago

on OS X go application cannot be completely stopped in debug mode by "stop" button Yes, app is "stopped" in idea, but i see running go processes in memory

Idea console output: /Users/bald/.gvm/gos/go1.5.2/bin/go build -o /private/var/folders/ys/pz3b29x14_zbzj9s39422pg80000gn/T/run14go -gcflags "-N -l" /Users/bald/projects/indriver.git/go-server/server/src/Main.go "/Users/bald/Library/Application Support/IntelliJIdea15/Go/lib/dlv/mac/dlv" --listen=localhost:64506 --headless=true exec /private/var/folders/ys/pz3b29x14_zbzj9s39422pg80000gn/T/run14go -- conf/bald.config.json could not deliver signal: operation not permitted

Result of ps ax|egrep '\(run14go)$' before start app (already 8 unused go processes) 1909 ?? Z 0:00.00 (run14go) 4801 ?? Z 0:00.00 (run14go) 4944 ?? Z 0:00.00 (run14go) 4992 ?? Z 0:00.00 (run14go) 5012 ?? Z 0:00.00 (run14go) 5086 ?? Z 0:00.00 (run14go) 5109 ?? Z 0:00.00 (run14go) 5137 ?? Z 0:00.00 (run14go)

after start and stop debug session there are 9 processes 1909 ?? Z 0:00.00 (run14go) 4801 ?? Z 0:00.00 (run14go) 4944 ?? Z 0:00.00 (run14go) 4992 ?? Z 0:00.00 (run14go) 5012 ?? Z 0:00.00 (run14go) 5086 ?? Z 0:00.00 (run14go) 5109 ?? Z 0:00.00 (run14go) 5137 ?? Z 0:00.00 (run14go) 5184 ?? Z 0:00.00 (run14go)

Idea 15.01 go plugin 0.10.749 go 1.5.2 java 1.8. os x 10.11.1

app is simple web server like http.ListenAndServe("8080", router)

dlsniper commented 8 years ago

Hi, thanks for the really detailed bug report. Just to be complete, could you please add a small sample of a program that reproduces this? I'll pass this to @ignatov as I don't have a Mac to check it unfortunately. Thank you!

bald2b commented 8 years ago

Hi, sample of code

package main
import (
    "net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("hi"))
}
func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8082", nil)
}

And i notice if stop debugger from breakpoint then app stopped ok

zolotov commented 8 years ago

@ignatov I think it's delve's bug. We don't run actual application, delve does. Also the first debug run/stop works fine, every other debug stopping produces could not deliver signal: operation not permitted or cannot resume process and leaves zombies after itself:

~  ᐅ ps ax|egrep 's.go'
31918   ??  Z      0:00.00 (Build s.go and r)
31958   ??  Z      0:00.00 (Build s.go and r)
31977   ??  Z      0:00.00 (Build s.go and r)
32004   ??  Z      0:00.00 (Build s.go and r)

Please investigate and forward to delve repo.

dlsniper commented 8 years ago

I think this was fixed in https://github.com/go-lang-plugin-org/go-lang-idea-plugin/issues/2224 but I can't be 100% sure as I don't have a Mac (the description however fits the issue).