Open heku opened 5 days ago
@heku I can reproduce this open cursor behavior. However, the DB does keep recent cursors open even after ODP.NET closes the connection. ODP.NET can inform the DB server when cursors are no longer needed, but it cannot force the DB to remove those cursors.
Are you running out of cursors or seeing a cursor leak under a heavy load? If the DB is not releasing cursors under a heavy load, then we should look at that behavior.
@alexkeh yes, due to this behavior, dba reported our app's open cursors count come up to limitation. Better to provide a way to release them (except disabling the connection pool)
@heku Some possible reasons the cursors are not being released are ODP.NET statement caching and metadata pooling, which are on by default. These can hold cursors open after connections close since it's common for pooled users to execute the same statement again. Having the statement parse and metadata cached speeds up subsequent executions. This is why you can see cursors still open for a single or few statements.
When we observe the DB hitting the open cursor count limit, this usually means the cursors are not being closed explicitly or there's an Oracle bug. The bug could be in either the client or DB layer. I recommend creating an Oracle Support service request. Cursor leaks are difficult to diagnose. It's very hard to create a reproducible test case to diagnose unless it's forgetting a Close/Dispose somewhere. It sounds like you've already checked for that.
@alexkeh tks for the explanation.
Start a database instance by
Create a simple console app
I expect there is not opened cursors for current connection, as it's closed and disposed.