Closed tgulacsi closed 3 years ago
With gdb, I've tried to look into what's going on:
gotip test -c && mv godror.test.tip && gdb godror.test.tip
, after run, I got the
Thread 1 "godror.test.tip" received signal SIGSEGV, Segmentation fault.
0x00000000006e662a in dpiContext_getClientVersion (context=0xb59ba0, versionInfo=0xc0001b0270)
at /home/gthomas/src/github.com/godror/godror/odpi/embed/../src/dpiContext.c:260
260 memcpy(versionInfo, context->versionInfo, sizeof(dpiVersionInfo));
(gdb) p *context
$1 = {typeDef = 0x988ce0 <dpiAllTypeDefs+416>, checkInt = 3625685377, refCount = 1, env = 0x0,
defaultEncoding = 0xb59c10 "UTF-8", defaultDriverName = 0xa630b0 "godror : v0.23.2", versionInfo = 0xba0,
dpiMinorVersion = 1 '\001'}
Here the address of context->versionInfo=0xba0
is quite strange (short).
Esp. when I compare it to the working 1.15.7:
go test -c && mv godror.test godror.test.15.7 && gdb godror.test.15.7
:
(gdb) b dpiContext.c:260
Breakpoint 1 at 0x71177e: file /home/gthomas/src/github.com/godror/godror/odpi/embed/../src/dpiContext.c, line 260.
(gdb) run
Thread 1 "godror.test.15." hit Breakpoint 1, dpiContext_getClientVersion (context=0xab7030, versionInfo=0xc0001564c0)
at /home/gthomas/src/github.com/godror/godror/odpi/embed/../src/dpiContext.c:260
260 memcpy(versionInfo, context->versionInfo, sizeof(dpiVersionInfo));
(gdb) p *context
$1 = {typeDef = 0x9ddce0 <dpiAllTypeDefs+416>, checkInt = 3625685377, refCount = 1, env = 0x0,
defaultEncoding = 0xab7070 "UTF-8", defaultDriverName = 0xab7090 "godror : v0.23.2",
versionInfo = 0xa2db60 <dpiOciLibVersionInfo>, dpiMinorVersion = 1 '\001'}
Here context->versionInfo=0xa2db60
is "longer".
Here the address of
context->versionInfo=0xba0
is quite strange (short).
That probably implies that context
is NULL.
Is there a reason to believe that this is a bug in the Go toolchain or library? (Have you tried reproducing the failure using the same pattern of calls and inputs in a pure C program, and if so does it still reproduce?)
Have you tried running with GODEBUG=cgocheck=2
, and/or under various C sanitizers (-fsanitize=address
, -fsanitize=thread
, -fsanitize=undefined
, etc.)?
context=0xb59ba0
- AFAIK that's not null.
As it has been working since Go 1.9, and works with 1.15.7, but fails with 1.16.rc1 (and tip), I think that highly correlates.
Works with GODEBUG=cgocheck=2
, panics with cgocheck=0 and cgocheck=1.
How to use those sanitizers?
CC @ianlancetaylor @hajimehoshi
I get SIGSEV on master of godror for all of go1.14.13
, go1.14.14
, go1.15.6
, go1.15.7
, gotip
(+c8bd801
)
yes, on Arch using an unofficial repository
and earlier versions such as v0.23.0 test fine (or at least don't crash)
@seankhliao thanks! Only TestNewDriver fails with GODEBUG=cgocheck={0,1} !
Maybe it's something fishy on the -dark- (C/OCI/ODPI) side that's triggered now without those write barriers...
What version of Go are you using (
go version
)?1.16.rc1, gotip
Does this issue reproduce with the latest release?
dev c8bd801
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run
go test
for github.com/godror/godor v0.23.2What did you expect to see?
The test runs successfully.
What did you see instead?