mattn / go-oci8

Oracle driver for Go using database/sql
https://mattn.kaoriya.net/
MIT License
630 stars 212 forks source link

OCIEnvCreate error #423

Open zhongmin2015 opened 2 years ago

zhongmin2015 commented 2 years ago

The error is this,and how can i deal with it? panic: OCIEnvCreate error

goroutine 1 [running]: github.com/mattn/go-oci8.init.0() C:/Users/kingdee/go/pkg/mod/github.com/mattn/go-oci8@v0.0.8/globals.go:177 +0x518

mattn commented 2 years ago

Hmm, I don't get this. I'll fix this issue but Could you please temporally modify globals.go like below?

println(result)
panic("OCIEnvCreate error")
foolmacky commented 2 years ago

Hi, I encounterd a similar situation. In my case, the reason is combination of OS and golang. Here is golang's issue. https://github.com/golang/go/issues/49138

At first, golang v1.16.12(not accurate) on macOS monterey, an error occured while testing. And same source on linux, no errors.

fatal error: unexpected signal during runtime execution
[signal SIGBUS: bus error code-0x2 addr=0x7ff89b0ccd20 pc=0x7ff8196dc5d]

runtime stack:
runtime.throw(0x42a4697, 0x2a)
    /usr/local/go/src/runtime/panic.go:1117 +0x72
runtime.sigpanic()
    /usr/lcal/go/src/runtime signal_unix.go:718 +0x2ef

goroutine 1 [syscall, locked to thread]:
rintime.cgocall(0x4206b80, 0xc000139738, 0x5500a68)
    /usr/local/go/src/runtime/cgocall.go:154 +0x7a fp=0xc000139708 sp=0xc0001396d0 pc=0x40068fa
github.com/mattn/go-oci8. Cfunc_OCIEnvCreate(0xc000124038, 0xc000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    _cgo_gotypes.go:535 +0x6b fp=0xc000139738 sp=0xc000139708 pc=0x41d078b
github.com/mattn/go-oci8.init.0.func1(0xc000124038, 0xc000124038)
    /Users/(...)/go/pkg/mod/github.com/mattn/go-oci8@v0.1.1/globals.go:180 +0x79 fp=0xc000139798 sp=0xc000139738 pc=0x41ee9f9
github.com/mattn/go-oci8.init.0()
    /Users/(...)/go/pkg/mod/github.com/mattn/go-oci8@v0.1.1/globals.go:180 +0xc5 fp=0xc000139a48 sp=0xc000139738 pc=0x41d7685

//another pattern
objc[8119]: Attempt to use unknown class 0x7ff85b0772e0.
SIGABRT: abort
PC=0x7ff81982cdfe m=0 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
rintime.cgocall(0x4206b80, 0xc000bd738, 0x55005b8)
    /usr/local/go/src/runtime/cgocall.go:154 +0x7a fp=0xc0000bd708 sp=0xc0000bd6d0 pc=0x40068da
github.com/mattn/go-oci8. Cfunc_OCIEnvCreate(0xc0000a6038, 0xc000000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    _cgo_gotypes.go:535 +0x6b fp=0xc0000bd738 sp=0xc0000bd708 pc=0x41d076b
github.com/mattn/go-oci8.init.0.func1(0xc0000a6038, 0xc0000a6038)
    /Users/(...)/go/pkg/mod/github.com/mattn/go-oci8@v0.1.1/globals.go:180 +0x79 fp=0xc0000bd798 sp=0xc0000bd738 pc=0x41ee9f9
github.com/mattn/go-oci8.init.0()
    /Users/(...)/go/pkg/mod/github.com/mattn/go-oci8@v0.1.1/globals.go:180 +0xc5 fp=0xc0000bda48 sp=0xc0000bd798 pc=0x41d7665
     (...)
rax    0x2000209
rbx    0x80
rcx    0x7ff7bfefbfa8
rdx    0x0
rdi    0x8
rsi    0x1
rbp    0x7ff7bfefbff0
rsp    0x7ff7bfefbfa8
r8     0x600002c00180
r9     0x80
r10    0x0
r11    0x246
r12    0x0
r13    0x0
r14    0x1
r15    0x8
rip    0x7ff81982cdfe
rflags 0x246
cs     0x7
fs     0x0
gs     0x0

After upgrading to golang v1.17.7, the probrem was solved.

xiaoqiang-coder01 commented 10 months ago

The error is this,and how can i deal with it? panic: OCIEnvCreate error

goroutine 1 [running]: github.com/mattn/go-oci8.init.0() C:/Users/kingdee/go/pkg/mod/github.com/mattn/go-oci8@v0.0.8/globals.go:177 +0x518

您好,请问解决了吗,我也遇到这个问题: 本地代码运行通过,编译后的linux版本程序在另一台服务器上运行,也是报这个错误;如解决请告知下解决方式,谢谢!