[Mono-bugs] [Bug 610946] New: Files still open when using Pooling
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Jun 2 08:32:44 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=610946
http://bugzilla.novell.com/show_bug.cgi?id=610946#c0
Summary: Files still open when using Pooling
Classification: Mono
Product: Mono: Class Libraries
Version: 2.6.x
Platform: 64bit
OS/Version: openSUSE 11.2
Status: NEW
Severity: Major
Priority: P5 - None
Component: Mono.Data.Sqlite
AssignedTo: mhabersack at novell.com
ReportedBy: goldywhite at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5
Sqlite doesn't closes files and doesn't reuse its when Pooling set True.
Reproducible: Always
Steps to Reproduce:
using System;
using System.Data;
using System.Diagnostics;
using Mono.Data.Sqlite;
class Program
{
private static int maxFiles;
private const string connectionString = "Data Source=test.db3;
Pooling=True; Min Pool Size = 10; Max Pool Size = 10;";
private const int recordCount = 5000;
private static readonly ProcessStartInfo psi;
static Program()
{
psi = new ProcessStartInfo("/bin/bash", "./lsof.sh " +
Process.GetCurrentProcess().Id)
{RedirectStandardOutput =
true, UseShellExecute = false};
System.IO.File.WriteAllText("./lsof.sh","lsof -p$1 | grep -c
test.db3");
}
private static int CheckCnt()
{
var p = new Process { StartInfo = psi };
p.Start();
var cnt = int.Parse(p.StandardOutput.ReadToEnd().Trim());
if (cnt > maxFiles)
{
maxFiles = cnt;
Console.WriteLine("opened files: {0}", cnt);
}
return maxFiles;
}
static void Main(string[] args)
{
Console.WriteLine("Process started");
CheckCnt();
FillTable();
Console.WriteLine("Data prepared");
CheckCnt();
for (var j = 0; j < int.MaxValue; j++ )
{
Do();
Console.WriteLine("Step {0}: {1} files opened", j, CheckCnt());
}
}
private static void Do()
{
for (var i = 1; i <= recordCount; i++)
Select(i);
}
private static void FillTable()
{
using (var conn = new SqliteConnection { ConnectionString =
connectionString })
{
conn.Open();
try
{
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "CREATE TABLE Test (N INTEGER PRIMARY
KEY NOT NULL , NAME VARCHAR(80));";
cmd.ExecuteNonQuery();
}
}
catch
{
}
conn.Close();
}
}
private static void Select(int i)
{
using (var conn = new SqliteConnection { ConnectionString =
connectionString })
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "select N,NAME from Test where n=:n";
cmd.Parameters.Add("n", DbType.Int64).Value = i;
using (var reader = cmd.ExecuteReader())
{
string res = null;
while(reader.Read())
res = string.Format("selected Hello{0} with n={0}:
{1}", i,
reader.Read() &&
reader["NAME"].ToString() == "Hello" + (i));
}
}
conn.Close();
}
}
}
Actual Results:
Process started
Data prepared
Step 0: 67 files opened
Step 1: 194 files opened
Step 2: 308 files opened
Step 3: 424 files opened
Step 4: 542 files opened
Step 5: 655 files opened
Step 6: 768 files opened
Step 7: 876 files opened
Step 8: 993 files opened
Unhandled Exception: Mono.Data.Sqlite.SqliteException: Unable to open the
database file
at Mono.Data.Sqlite.SQLite3.Open (System.String strFilename,
SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) [0x000
00] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteConnection.Open () [0x00000] in <filename
unknown>:0
Expected Results:
Process started
Data prepared
Step 0: 10 files opened
Step 1: 10 files opened
Step 2: 10 files opened
Step 3: 10 files opened
..........
When set Pooling=False files closes properly
--
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