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.
0.7.4.1
Oren Hurvitz 2012-07-16 10:30:38 +03:00 committed by Justin Clark-Casey (justincc)
parent 72075e68c7
commit 0588f27d18
1 changed files with 11 additions and 5 deletions

View File

@ -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,6 +213,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
finally
{
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;