go-goracle / goracle

Go database/sql driver for connecting to Oracle Database, using the ODPI-C library
273 stars 43 forks source link

panic on rows.Next() call #120

Closed kog4096 closed 5 years ago

kog4096 commented 5 years ago

My program panics on a call to rows.Next(). It works well across numerous servers/databases, but seems to be randomly failing without explanation. Any help would be appreciated.

My line of code: for rows.Next() {

The panic:

fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x3cd7000 pc=0x7f8f6196155e]

runtime stack: runtime.throw(0x60754c, 0x2a) /usr/local/go/src/runtime/panic.go:616 +0x81 runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:372 +0x28e

goroutine 1 [syscall]: runtime.cgocall(0x5964e0, 0xc4200da4d8, 0x29) /usr/local/go/src/runtime/cgocall.go:128 +0x64 fp=0xc4200da498 sp=0xc4200da460 pc=0x40f2e4

gopkg.in/goracle%2ev2._Cfunc_dpiStmt_fetchRows(0x1a93390, 0x100, 0xc42012a330, 0xc42012a334, 0xc420e18b40, 0xc400000000) _cgo_gotypes.go:2837 +0x4d fp=0xc4200da4d8 sp=0xc4200da498 pc=0x53c05d

gopkg.in/goracle%2ev2.(*rows).Next.func1(0x1a93390, 0xc400000100, 0xc42012a330, 0xc42012a334, 0xc420e18b40, 0x44b3a7)

/go/src/gopkg.in/goracle.v2/rows.go:278 +0x7c fp=0xc4200da518 sp=0xc4200da4d8 pc=0x55fc0c gopkg.in/goracle%2ev2.(*rows).Next(0xc42012a310, 0xc420143080, 0x2a, 0x2a, 0xc4200da998, 0x473751) /go/src/gopkg.in/goracle.v2/rows.go:278 +0x28db fp=0xc4200da938 sp=0xc4200da518 pc=0x54b87b database/sql.(*Rows).nextLocked(0xc42013e180, 0xc420ee0000) /usr/local/go/src/database/sql/sql.go:2622 +0xc4 fp=0xc4200da980 sp=0xc4200da938 pc=0x4faeb4 database/sql.(*Rows).Next.func1() /usr/local/go/src/database/sql/sql.go:2600 +0x3c fp=0xc4200da9b0 sp=0xc4200da980 pc=0x4fc95c database/sql.withLock(0x621480, 0xc42013e1b0, 0xc4200da9f8) /usr/local/go/src/database/sql/sql.go:3032 +0x63 fp=0xc4200da9d8 sp=0xc4200da9b0 pc=0x4fc163 database/sql.(*Rows).Next(0xc42013e180, 0xc420b55680) /usr/local/go/src/database/sql/sql.go:2599 +0x7a fp=0xc4200daa28 sp=0xc4200da9d8 pc=0x4fadba main.processPlugin(0xc420096220, 0x16, 0x1, 0xc420014cc0, 0xb, 0xc420014cac, 0x4, 0xc420014cd0, 0x9, 0xc420014ce0, ...) /main.go:284 +0x2e86 fp=0xc4200db800 sp=0xc4200daa28 pc=0x571386
tgulacsi commented 5 years ago

No idea. What version of gopkg.in/goracle.v2 ? When does it happen? First iteration, or later? Does it say anything when compiled with "-race" ?

kog4096 commented 5 years ago

Version 2.9.0 Occurrence is not on first iteration Results are the same when compiled with -race

tgulacsi commented 5 years ago

The best would be a small reproducing test case.

If that's not possible, then you have to debug it, as I haven't met with such a panic yet.

Set goracle.Log to a function to see what goracle is doing - maybe add some more Log statements here and there. But you can easily turn on ODPI-C's (the layer under goracle) logging by setting the "DPI_DEBUG_LEVEL" environment variable to something bigger than 0.

Maybe I can help if you provide some details about the program: a sketch of what it's doing, the query, its column types and so on.

drsect0r commented 5 years ago

During a production release, we also noticed this panic and temporarily solved it by reverting back to commit ef6b405f3ecf92728d19bcf35839a6d787ebb153.

I will try to provide more information later this week.

tgulacsi commented 5 years ago

That's quite strange, as that is v2.9.0 !

Maybe you've used master beforehand?

drsect0r commented 5 years ago

@tgulacsi Correct, we used master beforehand as we build everything in docker against masters. (we have very few dependencies) I will try to give a panic stack trace tomorrow.

tgulacsi commented 5 years ago

Ok, so you've reported this on 7th November, 12:27 GMT+1, that means we're investigating ef6b405f3ecf92728d19bcf35839a6d787ebb153..7a4f00319f5be9dd5d3c321fe2e80b7fc0347b36 but I don't see anything that may panic.

Do you use Trace tags?