Make a quick stab at the "Open data reader" issue.

MySqlDataReader needs to be Close()d explicitly. Disposing it or letting
it fall out of scope will not free it's hold on the connection.
0.6.1-post-fixes
Melanie Thielker 2008-11-16 04:39:41 +00:00
parent 3de41ea377
commit 8e119130c5
1 changed files with 20 additions and 8 deletions

View File

@ -212,16 +212,23 @@ namespace OpenSim.Data.MySQL
{
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, m_connection);
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
lock (m_dataSet)
{
if (dbReader.Read())
MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow);
try
{
m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
}
if (dbReader.Read())
{
m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
}
dbReader.Close();
cmd.Dispose();
cmd.Dispose();
}
finally
{
dbReader.Close();
}
}
m_lastConnectionUse = System.DateTime.Now.Ticks;
@ -571,7 +578,8 @@ namespace OpenSim.Data.MySQL
lock (m_dataSet)
{
CheckConnection();
using (MySqlDataReader row = cmd.ExecuteReader())
MySqlDataReader row = cmd.ExecuteReader();
try
{
int rev = 0;
if (row.Read())
@ -595,6 +603,10 @@ namespace OpenSim.Data.MySQL
m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
}
finally
{
row.Close();
}
}
return terret;
}