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

Crash when using Delve debugger #369

Closed
EvgenySerg opened this issue Jan 10, 2017 · 12 comments
Closed

Crash when using Delve debugger #369

EvgenySerg opened this issue Jan 10, 2017 · 12 comments

Comments

@EvgenySerg
Copy link

I have c crash while debugging with Delve (VS Code).
I updated the go-sqllite yesterday, and after that i've got a crash on both my PC (2 systems with windows - crash). Linux is OK. I have same GOPATH folder for them all.

Debug log is:
Exception 0xc0000005 0x8 0xa8c148 0xa8c148
PC=0xa8c148
signal arrived during external code execution

Error is from here (bold selection):
//package sql:
// Close closes the database, releasing any open resources.
//
// It is rare to Close a DB, as the DB handle is meant to be
// long-lived and shared between many goroutines.
func (db *DB) Close() error {
db.mu.Lock()
if db.closed { // Make DB.Close idempotent
db.mu.Unlock()
return nil
}
close(db.openerCh)
var err error
fns := make([]func() error, 0, len(db.freeConn))
for _, dc := range db.freeConn {
fns = append(fns, dc.closeDBLocked())
}
db.freeConn = nil
db.closed = true
for _, req := range db.connRequests {
close(req)
}
db.mu.Unlock()
for _, fn := range fns {
err1 := fn()
if err1 != nil {

err = err1
}
}
return err
}

@EvgenySerg EvgenySerg changed the title Crash when uding Delve debugging Crash when using Delve debugging Jan 10, 2017
@EvgenySerg EvgenySerg changed the title Crash when using Delve debugging Crash when using Delve debugger Jan 10, 2017
@Eun
Copy link

Eun commented Feb 28, 2017

Got exactly the same problem, if you found a fix please tell us 😉

Edit is this related to #272?

@justinclift
Copy link

justinclift commented Mar 13, 2017

@Eun It probably is. Golang on non-Linux (eg OSX, Windows) seems to be er... missing some important debug information which delve needs. Apparently this is being fixed for Go 1.9, but doesn't really help us much now. 😦

As a thought, JetBrains has some delve binaries available with short term fixes applied which might help:

    https://bintray.com/jetbrains/golang/delve

No guarantees though. 😁

(They're bundled with Gogland, if that's your kind of thing)

@Eun
Copy link

Eun commented Mar 20, 2017

@justinclift For me go 1.9 does not fix the problem. Also jetbrains has only linux and mac binaries. So no fix for windows...

@justinclift
Copy link

justinclift commented Mar 20, 2017

@Eun Gah. I was really looking forward to 1.9 fixing much of our debugging issues. 😦

With the Jetbrains provided Delve binaries, when I unzip any of the recent ones they definitely include a Windows version. eg:

    https://bintray.com/jetbrains/golang/delve/0.11.359#files/com/jetbrains/delve/0.11.359

In that .zip file, it has three subdirectories with delve executables:

  • linux
  • mac
  • windows

Is it different for you?

@Eun
Copy link

Eun commented Mar 21, 2017

@justinclift You are right, I somehow used the old 0.6.65 version... 😮

Edit: but it makes no diffrence: 😢

signal arrived during external code execution

Also: dlv version reports Version 0.12.1...

@justinclift
Copy link

@Eun Do you have a simple reproducer for the crash? The Jetbrains people were asking (via email) the other day when I mentioned it to them.

I haven't gotten around to making a simple crash causer yet. If you have a simple code listing handy with reliably causes the crash, we can point the JetBrains people at it for investigation.

@Eun
Copy link

Eun commented Mar 22, 2017

@justinclift
I just noticed go 1.9 is not even out there, so still hope for go 1.9 to fix it.
However here is an example:

a.go:

package main

import (
	"database/sql"

	"fmt"

	_ "github.com/mattn/go-sqlite3"
)

func main() {
	db, err := sql.Open("sqlite3", "test.db")
	if err != nil {
		panic(err)
	}
	_, err = db.Exec(`
		CREATE TABLE IF NOT EXISTS
		Config (
			'Section' TEXT NOT NULL,
			'Key' TEXT NOT NULL,
			'Value' TEXT NOT NULL
		)`)
	if err != nil {
		panic(err)
	}
	fmt.Println("Everything worked")
}

launch.json:

    {
        "name": "TEST",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "remotePath": "",
        "port": 2345,
        "host": "127.0.0.1",
        "program": "${workspaceRoot}/a.go",
        "env": {
            "GOPATH": "${workspaceRoot}"
        },
        "args": [],
        "showLog": true,
        "cwd": "${workspaceRoot}"
    }

Operating system is Windows 10 x64 (1607)
Go is go version go1.8 windows/amd64

Hopefully this helps somehow...

@justinclift
Copy link

Ahhh, that is a good sample. 😄

For me, trying it out on OSX 10.11.6, running Go 1.8, it errors out with the following when trying to debug:

# command-line-arguments
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol close
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol access
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol getcwd
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol stat$INODE64
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fstat$INODE64
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol ftruncate
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fcntl
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol read
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol pread
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol write
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol pwrite
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fchmod
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol unlink
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol mkdir
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol rmdir
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol fchown
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol geteuid
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol mmap
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol munmap
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol readlink
github.com/mattn/go-sqlite3(__DATA/__data): unexpected reloc for dynamic symbol lstat$INODE64
/usr/local/Cellar/go/1.8/libexec/pkg/tool/darwin_amd64/link: too many errors

When running it normally, the output (as expected) is:

Everything worked

There's a bug report with that kind of error on the Gogland issue tracker already, so I'll add your example code in there and see if they're up for resolving it. It might turn out it needs to be reported on the delve issue tracker as well (unsure).

@justinclift
Copy link

@Eun I've added your reproducer to the Gogland issue about the problem. The error I'm seeing appears to be a problem with mattn's driver + OSX + Delve.

So, that's blocking me from even getting it compiled in Debug mode on OSX. 😦

@justinclift
Copy link

@Eun Out of curiosity, does that reproducer still crash for you when changing it to gwenn/gosqlite driver? eg from:

_ "github.com/mattn/go-sqlite3"

to:

_ "github.com/gwenn/gosqlite"

For me, it runs and debugs fine.

@gjrtimmer
Copy link
Collaborator

If this is still active can you compile on OSX with the tag libssqlite3.

@gjrtimmer
Copy link
Collaborator

Close due no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants