From 0588f27d1886970e44765166714f24114d399fce Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 16 Jul 2012 10:30:38 +0300 Subject: Fixed a rare bug that caused Save OAR to fail because it thought it had timed-out The bug manifested as follows: a large world was saved. All the assets were found. But for some unknown reason, the timeout timer was restarted. So after 1 minute it closed the Archive Writer, because it didn't receive any more assets during that minute. That caused the OAR to become corrupted because ArchiveWriteRequestExecution.Save() was still running. --- .../Region/CoreModules/World/Archiver/AssetsRequest.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 55110dc..a073cb9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -154,6 +154,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) { + bool close = true; + try { lock (this) @@ -161,7 +163,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Take care of the possibilty that this thread started but was paused just outside the lock before // the final request came in (assuming that such a thing is possible) if (m_requestState == RequestState.Completed) + { + close = false; return; + } m_requestState = RequestState.Aborted; } @@ -208,7 +213,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } finally { - m_assetsArchiver.ForceClose(); + if (close) + m_assetsArchiver.ForceClose(); } } @@ -242,11 +248,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_requestCallbackTimer.Stop(); - if (m_requestState == RequestState.Aborted) + if ((m_requestState == RequestState.Aborted) || (m_requestState == RequestState.Completed)) { m_log.WarnFormat( - "[ARCHIVER]: Received information about asset {0} after archive save abortion. Ignoring.", - id); + "[ARCHIVER]: Received information about asset {0} while in state {1}. Ignoring.", + id, m_requestState); return; } @@ -268,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_notFoundAssetUuids.Add(new UUID(id)); } - if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired) + if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count >= m_repliesRequired) { m_requestState = RequestState.Completed; -- cgit v1.1