mirror of
https://github.com/opensim/opensim.git
synced 2026-06-25 07:45:47 +08:00
Reverting the memory leak patch for MySQL. Problems have been reported with the grid server after running for several hours
This commit is contained in:
@@ -197,27 +197,29 @@ namespace OpenSim.Data.MySQL
|
||||
param["?xmax"] = xmax.ToString();
|
||||
param["?ymax"] = ymax.ToString();
|
||||
|
||||
using (IDbCommand result = dbm.Manager.Query(
|
||||
IDbCommand result =
|
||||
dbm.Manager.Query(
|
||||
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
|
||||
param))
|
||||
param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
RegionProfileData row;
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
while ((row = dbm.Manager.readSimRow(reader)) != null)
|
||||
{
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
RegionProfileData row;
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
while ((row = dbm.Manager.readSimRow(reader)) != null)
|
||||
rows.Add(row);
|
||||
|
||||
return rows.ToArray();
|
||||
}
|
||||
rows.Add(row);
|
||||
}
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return rows.ToArray();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.Message, e);
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
@@ -241,27 +243,29 @@ namespace OpenSim.Data.MySQL
|
||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||
param["?name"] = namePrefix + "%";
|
||||
|
||||
using (IDbCommand result = dbm.Manager.Query(
|
||||
"SELECT * FROM regions WHERE regionName LIKE ?name",
|
||||
param))
|
||||
IDbCommand result =
|
||||
dbm.Manager.Query(
|
||||
"SELECT * FROM regions WHERE regionName LIKE ?name",
|
||||
param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
RegionProfileData row;
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null)
|
||||
{
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
RegionProfileData row;
|
||||
|
||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||
|
||||
while (rows.Count < maxNum && (row = dbm.Manager.readSimRow(reader)) != null)
|
||||
rows.Add(row);
|
||||
|
||||
return rows;
|
||||
}
|
||||
rows.Add(row);
|
||||
}
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return rows;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.Message, e);
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
@@ -282,21 +286,21 @@ namespace OpenSim.Data.MySQL
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||
param["?handle"] = handle.ToString();
|
||||
param["?handle"] = handle.ToString();
|
||||
|
||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param))
|
||||
{
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||
return row;
|
||||
}
|
||||
IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.Message, e);
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
@@ -317,24 +321,23 @@ namespace OpenSim.Data.MySQL
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||
param["?uuid"] = uuid.ToString();
|
||||
param["?uuid"] = uuid.ToString();
|
||||
|
||||
using (IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE uuid = ?uuid", param))
|
||||
{
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||
return row;
|
||||
}
|
||||
IDbCommand result = dbm.Manager.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.Message, e);
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
dbm.Release();
|
||||
}
|
||||
@@ -356,21 +359,22 @@ namespace OpenSim.Data.MySQL
|
||||
// Add % because this is a like query.
|
||||
param["?regionName"] = regionName + "%";
|
||||
// Order by statement will return shorter matches first. Only returns one record or no record.
|
||||
using (IDbCommand result = dbm.Manager.Query(
|
||||
"SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1",
|
||||
param))
|
||||
{
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
IDbCommand result =
|
||||
dbm.Manager.Query(
|
||||
"SELECT * FROM regions WHERE regionName like ?regionName order by LENGTH(regionName) asc LIMIT 1",
|
||||
param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
RegionProfileData row = dbm.Manager.readSimRow(reader);
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return row;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.Message, e);
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
@@ -378,7 +382,6 @@ namespace OpenSim.Data.MySQL
|
||||
dbm.Release();
|
||||
}
|
||||
}
|
||||
|
||||
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
|
||||
return null;
|
||||
}
|
||||
@@ -391,12 +394,12 @@ namespace OpenSim.Data.MySQL
|
||||
override public DataResponse StoreProfile(RegionProfileData profile)
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
try
|
||||
{
|
||||
try {
|
||||
if (dbm.Manager.insertRegion(profile))
|
||||
{
|
||||
return DataResponse.RESPONSE_OK;
|
||||
else
|
||||
return DataResponse.RESPONSE_ERROR;
|
||||
}
|
||||
return DataResponse.RESPONSE_ERROR;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -414,14 +417,14 @@ namespace OpenSim.Data.MySQL
|
||||
{
|
||||
MySQLSuperManager dbm = GetLockedConnection();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
try {
|
||||
if (dbm.Manager.deleteRegion(uuid))
|
||||
{
|
||||
return DataResponse.RESPONSE_OK;
|
||||
else
|
||||
return DataResponse.RESPONSE_ERROR;
|
||||
}
|
||||
finally
|
||||
}
|
||||
return DataResponse.RESPONSE_ERROR;
|
||||
} finally
|
||||
{
|
||||
dbm.Release();
|
||||
}
|
||||
@@ -479,26 +482,26 @@ namespace OpenSim.Data.MySQL
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> param = new Dictionary<string, object>();
|
||||
param["?x"] = x.ToString();
|
||||
param["?y"] = y.ToString();
|
||||
using (IDbCommand result = dbm.Manager.Query(
|
||||
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
|
||||
param))
|
||||
{
|
||||
using (IDataReader reader = result.ExecuteReader())
|
||||
{
|
||||
ReservationData row = dbm.Manager.readReservationRow(reader);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
param["?x"] = x.ToString();
|
||||
param["?y"] = y.ToString();
|
||||
IDbCommand result =
|
||||
dbm.Manager.Query(
|
||||
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
|
||||
param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
ReservationData row = dbm.Manager.readReservationRow(reader);
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return row;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
dbm.Manager.Reconnect();
|
||||
m_log.Error(e.Message, e);
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
dbm.Release();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user