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.56k stars 571 forks source link

Program freezes when debugging #2864

Open kindlychung opened 7 years ago

kindlychung commented 7 years ago

I was justing trying to step over some functions.

The program should run until the next breakpoint.

Program freezes.

The entire project can be found here: https://github.com/kindlychung/code/blob/master/chapter2/sample/main.go (Code samples from the book Go in Action)

Video demo: https://www.youtube.com/watch?v=JtZb0J28NUI&feature=youtu.be

justinclift commented 7 years ago

This looks like the same problem I'm having when attempting to step through a program.

I've reduced it to a trivial example, 100% reproducible:

package main

import (
    "log"

    "github.com/gwenn/gosqlite"
)

func main() {
    log.Print("First")
    log.Print("Second")
    log.Print("Third")
}

func GetSQLiteRowCount() int {
    sqlite.Open("foo.db", sqlite.OpenReadOnly)
    return 0
}

(no need to create foo.db first)

This example runs fine. However, if you put a breakpoint on any of the log.Print() lines (eg "Second"), you can't proceed beyond it in Debug mode once it's hit. eg "Step Over" → program hang

First
Second
[hung program]

For me, this is pretty much a complete blocker. I have a server application I'm attempting to debug, and the hanging can't be worked around (I've tried various things over the last few hours).

So now I'm using Println statements, and need to find something practical that works.

UPDATE - This also happens in Gogland on OSX. It doesn't happen with WebStorm 2016.3.3 on Fedora Linux. Trying various other things now.

UPDATE 2 - Also reported against Gogland, which has a workaround: https://youtrack.jetbrains.com/issue/GO-3511

whilei commented 7 years ago

plus one

justinclift commented 7 years ago

@whilei If you're up for using Gogland, many of the debugging issues with this plugin are fixed there:

    https://www.jetbrains.com/go

:smile:

whilei commented 7 years ago

@justinclift aha! woops, hold on a second... I am using Gogland.

UPDATE 2 - Also reported against Gogland, which has a workaround: https://youtrack.jetbrains.com/issue/GO-3511

misread that too fast. thanks for sending me in the right direction

justinclift commented 7 years ago

No worries. :smile: