godror icon indicating copy to clipboard operation
godror copied to clipboard

session hanup when close prepared statement

Open giter opened this issue 3 years ago • 3 comments

[email protected],Stack as follow, reproducible after some workload:

0x7ff6f2241635 github.com/godror/godror._Cfunc_dpiStmt_release+0x55 _cgo_gotypes.go:4882 0x7ff6f2276099 github.com/godror/godror.(*statement).closeNotLocking.func2+0x39 C:/Users/L/go/pkg/mod/github.com/godror/[email protected]/stmt.go:348 0x7ff6f2275ff0 github.com/godror/godror.(*statement).closeNotLocking+0x3f0 C:/Users/L/go/pkg/mod/github.com/godror/[email protected]/stmt.go:348 0x7ff6f2275b1e github.com/godror/godror.(*statement).Close+0x9e C:/Users/Lijiajie/go/pkg/mod/github.com/godror/[email protected]/stmt.go:313 0x7ff6f216b55d database/sql.(*driverStmt).Close+0x9d c:/go/src/database/sql/sql.go:678 0x7ff6f216ee64 database/sql.(*DB).noteUnusedDriverStatement+0x124 c:/go/src/database/sql/sql.go:1434 0x7ff6f2176e3b database/sql.(*Stmt).finalClose+0x13b c:/go/src/database/sql/sql.go:2906 0x7ff6f216b9e1 database/sql.(*DB).removeDep+0xc1 c:/go/src/database/sql/sql.go:721 0x7ff6f2176c04 database/sql.(*Stmt).Close+0x204 c:/go/src/database/sql/sql.go:2890

giter avatar Sep 15 '22 12:09 giter

It's stuck in the OCI driver (_Cfunc_dpiStmt_release). What can be seen on db side, trace?

tgulacsi avatar Sep 15 '22 13:09 tgulacsi

nop, we have no such db side permission

giter avatar Sep 15 '22 16:09 giter

@giter, Can you provide some details

  • stacktrace of the threads at client side when the client application is hanging pstack <pid>
  • oracle instant client version
  • OS/Arch
  • minimal test program of app calls and reproducible scenario if possible.

As per the cause, we have seen cases where expire_time =1, tuning causes cleanup of sockets at both ends and hence normal termination of client/server..

Setting EXPIRE_TIME in C Clients (e.g. Godror):

  • With 18c+ client libraries it can be added as (EXPIRE_TIME=n) to the DESCRIPTION section of a connect descriptor
  • With 19c+ client libraries it can be used via Easy Connect: host/service?expire_time=n.
  • With 21c client libraries it can be used in a client-side sqlnet.ora.

sudarshan12s avatar Sep 18 '22 07:09 sudarshan12s