Skip to content

SIGSEGV when using multiple dpiContexts #153

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

Closed
tgulacsi opened this issue Jan 29, 2021 · 6 comments
Closed

SIGSEGV when using multiple dpiContexts #153

tgulacsi opened this issue Jan 29, 2021 · 6 comments
Assignees
Labels

Comments

@tgulacsi
Copy link

  1. What version of ODPI-C are you using (see dpi.h)?
    v4.1.0

  2. What OS (and version) is your application on?
    linux/amd64

  3. What compiler (and version) did you use?
    go v1.16rc1

  4. What is your version of the Oracle Client (e.g. Instant Client)? How was it installed? Where it is installed?
    21.1, official rpm

  5. What is your Oracle Database version?
    19.5

  6. What problem or error(s) you are seeing?
    cgo panic SIGSEGV golang/go#43977

dpiContext_getClientVersion SIGSEGVs on the second context

go test -run=NewDriver on godror v0.23.1 (2091233c574a27f0161d6d68c511e1773dab0133 sidesteps this problem with using one global dpiContext).

@anthony-tuininga
Copy link
Member

There shouldn't be any reason not to use a single context but it would be good to figure out the source of this issue, too. I'll take a look and get back to you.

@tgulacsi
Copy link
Author

tgulacsi commented Feb 2, 2021

This is a very strange error, and though reproducible in 9/10 of runs with Go 1.16rc1 (or tip), I've never seen it with Go <1.16.
The more strange thing is that it disappears with env GODEBUG=cgocheck=2, only happens with the less strict (!) cgocheck=0 and cgocheck=1 !
So some write barrier is used with cgocheck=2 that elides this error.

With current godror tip, you can compile a test binary (for debugging) with

go  test -c  # compile test binary into godror.test
env GODROR_SEPARATE_CONTEXT=1 ./godror.test -test.count=1 -test.run=SepContext

The test code is on line 16 of drv_test.go (opens, uses and closes separate dpiContexts).

For Go, you can either download if from one of the links at the bottom of https://golang.org/dl/ , or install it separately with

go get golang.org/dl/go1.16rc1

or use the tip in the same manner with

go get golang.org/dl/gotip && gotip download

@junaidriaz449
Copy link

I have also observed the exact same issue in C application. I can share a gdb backtrace if required.

@cjbj
Copy link
Member

cjbj commented Feb 22, 2021

@junaidriaz449 do you have a test case handy? @anthony-tuininga is a bit slammed at the moment, so a standalone test case would be handy.

I'm sure @anthony-tuininga will be interested why you are using multiple contexts, given his previous comment.

@anthony-tuininga
Copy link
Member

@tgulacsi, can you test with the changes made for #156? I believe they are related and that this issue is also resolved.

@tgulacsi
Copy link
Author

Thanks, I can confirm those fixes work!

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

No branches or pull requests

4 participants