Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

C# Oracle Managed Data Access - Possible Thread Leak

User_TZBJMOct 12 2021

Sitting with something that I'm trying to figure out, and I'm hoping someone has come across this before and found a solution.
I have a .Net Core application doing threaded work. The application connects to multiple Oracle instances to execute some queries. I have noticed that the threads created by Oracle.MangedDataAccess.Core is not being disposed of.
The application should be using around 30-40 threads. But leaving it to run for a bit, it ends up with hundreds of threads (950).
I use a helper method I wrote to create threads and is being used in another service without issue. The threads I am creating in code, is closing as expected. But these external code threads are not being closed.
The other database types like Microsoft SQL and IBM DB2 is working as expected (using shared code except when testing a connection or getting data).
Here is a screenshot of the threads (last column points to an internal method within theOracle.MangedDataAccess.dll:
Image of the threads being created and not disposed.I'm not sure if I'm missing anything here, but it does seem like threads are being created and not disposed correctly.
I use two methods to create connections. One to test and see if the connection is valid, and the other to get a `DataSet`.
TestConnection:
image.pngAnd Data:
image.pngI also added connection.Close and connection.Dispose just to make sure, and no luck.

This post has been answered by Alex Keh-Oracle on Oct 13 2021
Jump to Answer
Comments
Post Details
Added on Oct 12 2021
6 comments
1,775 views