-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Runtime error in LastInsertId & RowsAffected when using multiple goroutines #31
Comments
BTW, I'm using gorp (https://github.com/coopernurse/gorp). There doesn't seem to be much happening between the exec & the RowsAffected call:
|
Could you please show me the code you have? |
My code is just calling the Update method on a DBMap struct from the Gorp library, which really just seems to do an Exec & then call RowsAffected on the result. It also happens with the Insert method and LastInsertId. Code is here: https://github.com/coopernurse/gorp/blob/master/gorp.go If you want to look at my code, I'm happy to add you to the project - I'm planning on open sourcing it, just waiting on approval from the client. |
I was fixed about LastInsertId in yesterday. Please check latest. |
Sorry to take so long to test this out. That doesn't seem to have resolved the issue: goroutine 21 [syscall]: Any other suggestions? |
It seems that statement object is 0x0. Could you please show me your code? |
I'm using the Gorp library. Code for the update method can be found here: I don't see any way for the result to be nil unless it somehow returns a nil result with a nil error - is that possible? |
I sometimes get errors when using the driver with multiple goroutines, from the LastInsertId & RowsAffected methods - it appears that sometimes the db field of the SQLiteConn structure is nil:
goroutine 9 [syscall]:
github.com/mattn/go-sqlite3._Cfunc_sqlite3_changes(0x0, 0xf8402f2400)
github.com/mattn/go-sqlite3/_obj/_cgo_defun.c:114 +0x2f
github.com/mattn/go-sqlite3.(_SQLiteResult).RowsAffected(0xf840248c40, 0xf84024b390, 0x0, 0x0)
github.com/mattn/go-sqlite3/_obj/sqlite3.cgo1.go:265 +0x2e
database/sql.(_result).RowsAffected(0xf84024b390, 0xf8401b1a00, 0xfc, 0xf8402f2400)
/usr/local/go/src/pkg/database/sql/convert.go:0 +0x43
github.com/coopernurse/gorp.update(0xf840070d80, 0xf8400960c0, 0xf840070d80, 0x2568f90, 0x100000001, ...)
/Users/gutter/dev/poundsmtp/src/github.com/coopernurse/gorp/gorp.go:1095 +0x386
github.com/coopernurse/gorp.(*DbMap).Update(0xf840070d80, 0x2568f90, 0x100000001, 0xf8400ac510, 0x20ede0, ...)
/Users/gutter/dev/poundsmtp/src/github.com/coopernurse/gorp/gorp.go:658 +0x6e
main.validateMessages(0xf840110c60, 0xf8401adb40, 0x0, 0x0)
/Users/gutter/dev/poundsmtp/src/validate.go:325 +0x4ad
created by main.checkAccount
/Users/gutter/dev/poundsmtp/src/validate.go:84 +0x370
The text was updated successfully, but these errors were encountered: