attempt to try to fix mantis issue # 613, which seems to be a threading issue. Queue is only threadsafe if its a public static member, which in this case it wasn't. And we were locking it during both enqueues and dequeues. So have added those locks to a syncObject. But it still needs testing on a high load region, as that seems to be when the exception happened.
parent
3778840f36
commit
a5f5be8a0c
|
@ -43,6 +43,8 @@ namespace OpenSim.Region.Environment.Types
|
||||||
|
|
||||||
private List<LLUUID> m_ids;
|
private List<LLUUID> m_ids;
|
||||||
|
|
||||||
|
private object m_syncObject = new object();
|
||||||
|
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get { return m_queue.Count; }
|
get { return m_queue.Count; }
|
||||||
|
@ -53,21 +55,19 @@ namespace OpenSim.Region.Environment.Types
|
||||||
m_queue = new Queue<SceneObjectPart>();
|
m_queue = new Queue<SceneObjectPart>();
|
||||||
m_ids = new List<LLUUID>();
|
m_ids = new List<LLUUID>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
lock (m_ids)
|
lock (m_syncObject)
|
||||||
{
|
{
|
||||||
m_ids.Clear();
|
m_ids.Clear();
|
||||||
}
|
|
||||||
lock (m_queue)
|
|
||||||
{
|
|
||||||
m_queue.Clear();
|
m_queue.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Enqueue(SceneObjectPart part)
|
public void Enqueue(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
lock (m_ids)
|
lock (m_syncObject)
|
||||||
{
|
{
|
||||||
if (!m_ids.Contains(part.UUID))
|
if (!m_ids.Contains(part.UUID))
|
||||||
{
|
{
|
||||||
|
@ -80,11 +80,11 @@ namespace OpenSim.Region.Environment.Types
|
||||||
public SceneObjectPart Dequeue()
|
public SceneObjectPart Dequeue()
|
||||||
{
|
{
|
||||||
SceneObjectPart part = null;
|
SceneObjectPart part = null;
|
||||||
if (m_queue.Count > 0)
|
lock (m_syncObject)
|
||||||
{
|
{
|
||||||
part = m_queue.Dequeue();
|
if (m_queue.Count > 0)
|
||||||
lock (m_ids)
|
|
||||||
{
|
{
|
||||||
|
part = m_queue.Dequeue();
|
||||||
m_ids.Remove(part.UUID);
|
m_ids.Remove(part.UUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue