Skip to content

Instantly share code, notes, and snippets.

@captncraig
Created September 22, 2014 17:29
Show Gist options
  • Save captncraig/dfb0224ff4dfab1022e6 to your computer and use it in GitHub Desktop.
Save captncraig/dfb0224ff4dfab1022e6 to your computer and use it in GitHub Desktop.
Sql Panic
CREATE TABLE [dbo].[Foobar](
[Foo] [int] NULL
) ON [PRIMARY]
GO
package main
import (
"database/sql"
"fmt"
_ "github.com/denisenkom/go-mssqldb"
)
func main() {
db, err := sql.Open("mssql", "server=myserver;database=MyDb;")
if err != nil {
fmt.Println(err)
return
}
defer db.Close()
_, err = db.Query(`select top(1000) Foo,Bar from Foobar`)
if err != nil {
fmt.Println(err)
return
}
}
@captncraig
Copy link
Author

Panic produced:

fatal error: unexpected signal during runtime execution
[signal 0xc0000005 code=0x0 addr=0xb696fc8320 pc=0x425b90]

goroutine 16 [running]:
runtime.throw(0xd6b7e0)
c:/go/src/pkg/runtime/panic.c:520 +0x7e fp=0xc08211fa68 sp=0xc08211fa50
runtime.sigpanic()
c:/go/src/pkg/runtime/os_windows.c:352 +0x4b fp=0xc08211fa80 sp=0xc08211fa68
runtime.mallocgc(0x50, 0x0, 0x10)
c:/go/src/pkg/runtime/malloc.goc:154 +0x370 fp=0xc08211fae8 sp=0xc08211fa80
runtime.malloc(0x48)
c:/go/src/pkg/runtime/malloc.goc:264 +0x40 fp=0xc08211fb08 sp=0xc08211fae8
newdefer(0x20)
c:/go/src/pkg/runtime/panic.c:45 +0x91 fp=0xc08211fb30 sp=0xc08211fb08
runtime.deferproc(0x20, 0xa85d88, 0xc08200e410, 0x9f2800, 0xc0820088c0, 0x76)
c:/go/src/pkg/runtime/panic.c:87 +0x10 fp=0xc08211fb58 sp=0xc08211fb30
fmt.(_pp).handleMethods(0xc08200e410, 0x76, 0x0, 0xc082010100)
c:/go/src/pkg/fmt/print.go:691 +0x4fd fp=0xc08211fc30 sp=0xc08211fb58
fmt.(_pp).printArg(0xc08200e410, 0x9f2800, 0xc0820088c0, 0x76, 0x0, 0xc082008800)
c:/go/src/pkg/fmt/print.go:790 +0x5cc fp=0xc08211fd18 sp=0xc08211fc30
fmt.(*pp).doPrint(0xc08200e410, 0xc08211ff20, 0x1, 0x1, 0x101)
c:/go/src/pkg/fmt/print.go:1194 +0x347 fp=0xc08211fe00 sp=0xc08211fd18
fmt.Fprintln(0xe30420, 0xc08203a008, 0xc08211ff20, 0x1, 0x1, 0x0, 0x0, 0x0)
c:/go/src/pkg/fmt/print.go:254 +0x87 fp=0xc08211fe48 sp=0xc08211fe00
fmt.Println(0xc08211ff20, 0x1, 0x1, 0xc0820088c0, 0x0, 0x0)
c:/go/src/pkg/fmt/print.go:264 +0xb6 fp=0xc08211feb8 sp=0xc08211fe48
main.main()
D:/GoPath/src/sqltest.go:19 +0x234 fp=0xc08211ff50 sp=0xc08211feb8
runtime.main()
c:/go/src/pkg/runtime/proc.c:247 +0x144 fp=0xc08211ffa8 sp=0xc08211ff50
runtime.goexit()
c:/go/src/pkg/runtime/proc.c:1445 fp=0xc08211ffb0 sp=0xc08211ffa8
created by _rt0_go
c:/go/src/pkg/runtime/asm_amd64.s:97 +0x12c

goroutine 17 [syscall]:
runtime.goexit()
c:/go/src/pkg/runtime/proc.c:1445

goroutine 19 [finalizer wait]:
runtime.park(0x415510, 0xdad6e0, 0xd727e9)
c:/go/src/pkg/runtime/proc.c:1369 +0xac
runtime.parkunlock(0xdad6e0, 0xd727e9)
c:/go/src/pkg/runtime/proc.c:1385 +0x42
runfinq()
c:/go/src/pkg/runtime/mgc0.c:2644 +0xdd
runtime.goexit()
c:/go/src/pkg/runtime/proc.c:1445

goroutine 20 [chan receive]:
database/sql.(*DB).connectionOpener(0xc082046000)
c:/go/src/pkg/database/sql/sql.go:583 +0x70
created by database/sql.Open
c:/go/src/pkg/database/sql/sql.go:442 +0x397
exit status 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment