[Mono-bugs] [Bug 566421] New: Connections stay open after they are closed.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 21 10:27:45 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=566421

http://bugzilla.novell.com/show_bug.cgi?id=566421#c0


           Summary: Connections stay open after they are closed.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: i586
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Mono.Data.Sqlite
        AssignedTo: mhabersack at novell.com
        ReportedBy: novell.20.ianua at neverbox.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6)
Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)

When a database is opened and a query is done, a connection to that file stays
active, even if the connection is closes. 

If you have a LOT of quick selects, then you will get a "Too many open files"
exception.

Reproducible: Always

Steps to Reproduce:
1.Do a select
2.Close connection
3.Go to step 1.
4.Do this a few times and keep an eye on lsof - the connections stay open! 

This will cause an exception to be thrown if you do a LOT of selects.
Actual Results:  
The database file was held open by numerous processes.

Expected Results:  
The file should be open by a couple of process at most.

//Simple test to illustrate

string connString = "Data Source=/tmp/test.db3";
Mono.Data.Sqlite.SqliteConnection conn = 
    new Mono.Data.Sqlite.SqliteConnection(connString);            

//Create and set up test db
SqliteCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE test (id INT, label VARCHAR)";    
cmd.Connection.Open();
cmd.ExecuteNonQuery();
Console.WriteLine("Created db ");
cmd.CommandText = "INSERT INTO test (id, label) VALUES (1, 'One')";        
cmd.ExecuteNonQuery();
Console.WriteLine("Added data to db");
cmd.Connection.Close();

//Test select
cmd.CommandText = "SELECT label FROM test WHERE id = 1";        
int i = 0;
while(true) {
    i++;
    cmd.Connection.Open();
    object result = cmd.ExecuteScalar();
    cmd.Connection.Close();
    Console.WriteLine ("Select #" + i + ": " + result.ToString());
    System.Threading.Thread.Sleep(1000);
}
// Do a  #/usr/bin/lsof /tmp/test.db3 |wc -l
// a few times and cry a little.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list