diff options
author | John Hurliman | 2009-11-02 11:19:55 -0800 |
---|---|---|
committer | John Hurliman | 2009-11-02 11:19:55 -0800 |
commit | 6309fcc5b4b42102b5bb901dbbdf44846f5643f2 (patch) | |
tree | 9f71f2801c6ed6eaa40fe637b0cda520a9e5894f /OpenSim/Data/MySQL/MySQLManager.cs | |
parent | Fix an invalid argument exception in the remote admin module when. (diff) | |
download | opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.zip opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.gz opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.bz2 opensim-SC-6309fcc5b4b42102b5bb901dbbdf44846f5643f2.tar.xz |
Reverting the memory leak patch for MySQL. Problems have been reported with the grid server after running for several hours
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLManager.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLManager.cs | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index a724a50..a6cce57 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs | |||
@@ -134,16 +134,18 @@ namespace OpenSim.Data.MySQL | |||
134 | /// </summary> | 134 | /// </summary> |
135 | protected void GetWaitTimeout() | 135 | protected void GetWaitTimeout() |
136 | { | 136 | { |
137 | using (MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon)) | 137 | MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon); |
138 | |||
139 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | ||
138 | { | 140 | { |
139 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 141 | if (dbReader.Read()) |
140 | { | 142 | { |
141 | if (dbReader.Read()) | 143 | m_waitTimeout |
142 | { | 144 | = Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; |
143 | m_waitTimeout | ||
144 | = Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; | ||
145 | } | ||
146 | } | 145 | } |
146 | |||
147 | dbReader.Close(); | ||
148 | cmd.Dispose(); | ||
147 | } | 149 | } |
148 | 150 | ||
149 | m_lastConnectionUse = DateTime.Now.Ticks; | 151 | m_lastConnectionUse = DateTime.Now.Ticks; |
@@ -301,31 +303,31 @@ namespace OpenSim.Data.MySQL | |||
301 | { | 303 | { |
302 | CheckConnection(); | 304 | CheckConnection(); |
303 | 305 | ||
304 | using (MySqlCommand tablesCmd = new MySqlCommand( | 306 | MySqlCommand tablesCmd = |
305 | "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", | 307 | new MySqlCommand( |
306 | dbcon)) | 308 | "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", |
307 | { | 309 | dbcon); |
308 | tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); | 310 | tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); |
309 | 311 | ||
310 | using (MySqlDataReader tables = tablesCmd.ExecuteReader()) | 312 | using (MySqlDataReader tables = tablesCmd.ExecuteReader()) |
313 | { | ||
314 | while (tables.Read()) | ||
311 | { | 315 | { |
312 | while (tables.Read()) | 316 | try |
313 | { | 317 | { |
314 | try | 318 | string tableName = (string) tables["TABLE_NAME"]; |
315 | { | 319 | string comment = (string) tables["TABLE_COMMENT"]; |
316 | string tableName = (string)tables["TABLE_NAME"]; | 320 | if (tableList.ContainsKey(tableName)) |
317 | string comment = (string)tables["TABLE_COMMENT"]; | ||
318 | if (tableList.ContainsKey(tableName)) | ||
319 | { | ||
320 | tableList[tableName] = comment; | ||
321 | } | ||
322 | } | ||
323 | catch (Exception e) | ||
324 | { | 321 | { |
325 | m_log.Error(e.Message, e); | 322 | tableList[tableName] = comment; |
326 | } | 323 | } |
327 | } | 324 | } |
325 | catch (Exception e) | ||
326 | { | ||
327 | m_log.Error(e.ToString()); | ||
328 | } | ||
328 | } | 329 | } |
330 | tables.Close(); | ||
329 | } | 331 | } |
330 | } | 332 | } |
331 | } | 333 | } |
@@ -344,19 +346,19 @@ namespace OpenSim.Data.MySQL | |||
344 | { | 346 | { |
345 | CheckConnection(); // Not sure if this one is necessary | 347 | CheckConnection(); // Not sure if this one is necessary |
346 | 348 | ||
347 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | 349 | MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); |
348 | dbcommand.CommandText = sql; | 350 | dbcommand.CommandText = sql; |
349 | foreach (KeyValuePair<string, object> param in parameters) | 351 | foreach (KeyValuePair<string, object> param in parameters) |
350 | { | 352 | { |
351 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | 353 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); |
352 | } | 354 | } |
353 | 355 | ||
354 | return (IDbCommand)dbcommand; | 356 | return (IDbCommand) dbcommand; |
355 | } | 357 | } |
356 | catch (Exception e) | 358 | catch (Exception e) |
357 | { | 359 | { |
358 | // Return null if it fails. | 360 | // Return null if it fails. |
359 | m_log.Error("Failed during Query generation: " + e.Message, e); | 361 | m_log.Error("Failed during Query generation: " + e.ToString()); |
360 | return null; | 362 | return null; |
361 | } | 363 | } |
362 | } | 364 | } |
@@ -692,6 +694,8 @@ namespace OpenSim.Data.MySQL | |||
692 | ret.Add(attachpoint, item); | 694 | ret.Add(attachpoint, item); |
693 | } | 695 | } |
694 | 696 | ||
697 | r.Close(); | ||
698 | |||
695 | return ret; | 699 | return ret; |
696 | } | 700 | } |
697 | 701 | ||