Connection pool is not getting cleared on AppDomain unload.
Connection pool is not getting cleared on AppDomain unload.
Hi Team,
We found connection leak issue with the Devart when we use the connection in different AppDomain.
Scenario:
1. Create a console application which opens connection using Devart.
2. Create another console application with new AppDomain and from the new AppDomain try to execute the first console application
3. Here, the connection remains open even if we unload the newly created AppDomain.
4. We have verified this with V$session query.
ConsoleApplication1: Fire a select query using Devart.
private static void Main(string[] args)
{
Console.WriteLine(" Main in domain {0} called", AppDomain.CurrentDomain.FriendlyName);
String myConnString = "data source=orcl;user id=ABCD;password=ABCD;";
string mySelectQuery = "select * from TestDevart";
using (OracleConnection myConnection = new OracleConnection(myConnString)){
using (OracleCommand myCommand = new OracleCommand(mySelectQuery, myConnection)){
myConnection.Open();
using (OracleDataReader myReader = myCommand.ExecuteReader()){
while (myReader.Read()){
string testValue = myReader.GetString(myReader.GetOrdinal("TBLDESC"));}
myReader.Close(); } } }
Console.WriteLine("Query Fired..."); }
ConsoleApplication2: Create different AppDomain and execute the ConsoleApplication1.When we unload the newly created AppDomain, it should close the connection opened in ConsoleApplication1.
private static void Main(string[] args)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
Console.WriteLine("Original AppDomain: " + currentDomain.FriendlyName);
AppDomain secondDomain = AppDomain.CreateDomain("Second AppDomain");
secondDomain.ExecuteAssembly("ConsoleApplication1.exe");
AppDomain.Unload(secondDomain);
Console.WriteLine("Check the connection count");
Console.ReadLine();
}
Query to check the open connections:
select * from V$session where schemaname='xxx'
We found connection leak issue with the Devart when we use the connection in different AppDomain.
Scenario:
1. Create a console application which opens connection using Devart.
2. Create another console application with new AppDomain and from the new AppDomain try to execute the first console application
3. Here, the connection remains open even if we unload the newly created AppDomain.
4. We have verified this with V$session query.
ConsoleApplication1: Fire a select query using Devart.
private static void Main(string[] args)
{
Console.WriteLine(" Main in domain {0} called", AppDomain.CurrentDomain.FriendlyName);
String myConnString = "data source=orcl;user id=ABCD;password=ABCD;";
string mySelectQuery = "select * from TestDevart";
using (OracleConnection myConnection = new OracleConnection(myConnString)){
using (OracleCommand myCommand = new OracleCommand(mySelectQuery, myConnection)){
myConnection.Open();
using (OracleDataReader myReader = myCommand.ExecuteReader()){
while (myReader.Read()){
string testValue = myReader.GetString(myReader.GetOrdinal("TBLDESC"));}
myReader.Close(); } } }
Console.WriteLine("Query Fired..."); }
ConsoleApplication2: Create different AppDomain and execute the ConsoleApplication1.When we unload the newly created AppDomain, it should close the connection opened in ConsoleApplication1.
private static void Main(string[] args)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
Console.WriteLine("Original AppDomain: " + currentDomain.FriendlyName);
AppDomain secondDomain = AppDomain.CreateDomain("Second AppDomain");
secondDomain.ExecuteAssembly("ConsoleApplication1.exe");
AppDomain.Unload(secondDomain);
Console.WriteLine("Check the connection count");
Console.ReadLine();
}
Query to check the open connections:
select * from V$session where schemaname='xxx'
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connection pool is not getting cleared on AppDomain unload.
We have reproduced and fixed the bug with the connection remaining in the pool after the AppDomain upload. We will post here when the corresponding build of dotConnect for Oracle is available for download.
Re: Connection pool is not getting cleared on AppDomain unload.
When can we expect fix for this issue?
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connection pool is not getting cleared on AppDomain unload.
We are planning to release the next public build of dotConnect for SQLite at the end of the next week.
Re: Connection pool is not getting cleared on AppDomain unload.
You said build will be available for "dotConnect for SQLite". Here we are talking about "DotConnect for Oracle". Are both same or it is typo.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connection pool is not getting cleared on AppDomain unload.
Sorry for the misprint. We are planning to release the next public build of dotConnect for Oracle at the end of this week.
Re: Connection pool is not getting cleared on AppDomain unload.
Thanks for the response. We have reported one more issue at below thread.
http://forums.devart.com/viewtopic.php? ... 1&start=15
Its related to Char type is not working properly with unicode=true scenario. Just curios to know if, build for this weekend would be having fix for Char issue.
Thanks,
Sandeep
http://forums.devart.com/viewtopic.php? ... 1&start=15
Its related to Char type is not working properly with unicode=true scenario. Just curios to know if, build for this weekend would be having fix for Char issue.
Thanks,
Sandeep
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connection pool is not getting cleared on AppDomain unload.
This issue has not been fixed yet. We will post in the corresponding topic (http://forums.devart.com/viewtopic.php? ... 1&start=15) when the issue is fixed.sgawde wrote:Its related to Char type is not working properly with unicode=true scenario. Just curios to know if, build for this weekend would be having fix for Char issue.
Besides, the fix of the bug with the connection remaining in the pool after the AppDomain upload will not be included into the next public build. We will post here when the corresponding build of dotConnect for Oracle is available for download.
Re: Connection pool is not getting cleared on AppDomain unload.
Hi, just wanted to let you know i just encountered the same bug.
Any suggested workarounds?
Any eta on the fix?
Any suggested workarounds?
Any eta on the fix?
Re: Connection pool is not getting cleared on AppDomain unload.
Okay, I found my workaround. Disabling pooling does the trick, but it is a horrible workaround (works for now though).
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connection pool is not getting cleared on AppDomain unload.
We can't change the described behavior, as this will influence all the existing users and their applications will take longer to close.
As a workaround, you can try the following in your application:
Pool clearing will be performed in 10 to 40 seconds.
As a workaround, you can try the following in your application:
Code: Select all
AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);
static void CurrentDomain_DomainUnload(object sender, EventArgs e) {
OracleConnection.ClearAllPools();
}
Re: Connection pool is not getting cleared on AppDomain unload.
Pinturiccio wrote:We can't change the described behavior, as this will influence all the existing users and their applications will take longer to close.
As a workaround, you can try the following in your application:Pool clearing will be performed in 10 to 40 seconds.Code: Select all
AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload); static void CurrentDomain_DomainUnload(object sender, EventArgs e) { OracleConnection.ClearAllPools(); }
Sorry about this, but I REALLY need to know what it is that will break for other users if you let the sessions be cleared properly after unload. The issue is that the session is left hanging in Oracle, and spinning up a new AppDomain spins up a new session with the old one never disappearing. Please IN DETAIL explain to me how fixing this issue will affect anyone? Since re-entering the same appdomain is imposible (as far as i know it has been unloaded and is not accessible anymore) and spinning up a new app-domain will also open a new session.
The System.Data.Oracle client disconnected the session, now I will have to test the ODP driver and see what happens with that.
Re: Connection pool is not getting cleared on AppDomain unload.
Any feedback on how a fix would affect others?
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Connection pool is not getting cleared on AppDomain unload.
We will fix the issue by the next build.
Re: Connection pool is not getting cleared on AppDomain unload.
Any idea when the next build with this fix is going to be available?