diff options
author | meta7 | 2010-08-10 09:07:17 -0700 |
---|---|---|
committer | meta7 | 2010-08-10 09:07:17 -0700 |
commit | 1ead2ed5eea379c500d2657e7bed8908b376e336 (patch) | |
tree | 30c510a0fa2fcd99b73a3527d0dffa17b7de3804 /OpenSim | |
parent | remoning debug messages (diff) | |
download | opensim-SC-1ead2ed5eea379c500d2657e7bed8908b376e336.zip opensim-SC-1ead2ed5eea379c500d2657e7bed8908b376e336.tar.gz opensim-SC-1ead2ed5eea379c500d2657e7bed8908b376e336.tar.bz2 opensim-SC-1ead2ed5eea379c500d2657e7bed8908b376e336.tar.xz |
Add a stack trace to the error output on the recursive read lock warning on my RWlocks. Whilst recursive locks are safe, coupled with other issues we're experiencing with the TaskInventoryDictionary it implies that somewhere the lock is not being freed possibly due to a merge error somewhere, and thus it needs to be looked into.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/TaskInventoryDictionary.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 218 |
2 files changed, 128 insertions, 104 deletions
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 4b9a509..6b65fba 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Threading; | 30 | using System.Threading; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Xml; | 32 | using System.Xml; |
33 | using System.Diagnostics; | ||
33 | using System.Xml.Schema; | 34 | using System.Xml.Schema; |
34 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
35 | using log4net; | 36 | using log4net; |
@@ -90,6 +91,19 @@ namespace OpenSim.Framework | |||
90 | if (m_itemLock.RecursiveReadCount > 0) | 91 | if (m_itemLock.RecursiveReadCount > 0) |
91 | { | 92 | { |
92 | m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); | 93 | m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); |
94 | try | ||
95 | { | ||
96 | StackTrace stackTrace = new StackTrace(); // get call stack | ||
97 | StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | ||
98 | |||
99 | // write call stack method names | ||
100 | foreach (StackFrame stackFrame in stackFrames) | ||
101 | { | ||
102 | m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name); // write method name | ||
103 | } | ||
104 | } | ||
105 | catch | ||
106 | {} | ||
93 | m_itemLock.ExitReadLock(); | 107 | m_itemLock.ExitReadLock(); |
94 | } | 108 | } |
95 | if (m_itemLock.RecursiveWriteCount > 0) | 109 | if (m_itemLock.RecursiveWriteCount > 0) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3c3f4b7..4f6bc52 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Diagnostics; | ||
32 | using System.Threading; | 33 | using System.Threading; |
33 | using System.Xml; | 34 | using System.Xml; |
34 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
@@ -138,6 +139,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
138 | m_log.Error("[SceneObjectGroup.m_parts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); | 139 | m_log.Error("[SceneObjectGroup.m_parts] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue."); |
139 | try | 140 | try |
140 | { | 141 | { |
142 | StackTrace stackTrace = new StackTrace(); // get call stack | ||
143 | StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | ||
144 | |||
145 | // write call stack method names | ||
146 | foreach (StackFrame stackFrame in stackFrames) | ||
147 | { | ||
148 | m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name); // write method name | ||
149 | } | ||
150 | |||
141 | m_partsLock.ExitReadLock(); | 151 | m_partsLock.ExitReadLock(); |
142 | } | 152 | } |
143 | catch { } // Ignore errors, to allow resync | 153 | catch { } // Ignore errors, to allow resync |
@@ -317,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
317 | private bool m_scriptListens_notAtTarget = false; | 327 | private bool m_scriptListens_notAtTarget = false; |
318 | 328 | ||
319 | private bool m_scriptListens_atRotTarget = false; | 329 | private bool m_scriptListens_atRotTarget = false; |
320 | private bool m_scriptListens_notAtRotTarget = false; | 330 | private bool m_scriptListens_notAtRotTarget = false; |
321 | public bool m_dupeInProgress = false; | 331 | public bool m_dupeInProgress = false; |
322 | internal Dictionary<UUID, string> m_savedScriptState = null; | 332 | internal Dictionary<UUID, string> m_savedScriptState = null; |
323 | 333 | ||
@@ -475,21 +485,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
475 | { | 485 | { |
476 | part.IgnoreUndoUpdate = false; | 486 | part.IgnoreUndoUpdate = false; |
477 | part.StoreUndoState(UndoType.STATE_GROUP_POSITION); | 487 | part.StoreUndoState(UndoType.STATE_GROUP_POSITION); |
478 | part.GroupPosition = val; | 488 | part.GroupPosition = val; |
479 | if (!m_dupeInProgress) | 489 | if (!m_dupeInProgress) |
480 | { | 490 | { |
481 | part.TriggerScriptChangedEvent(Changed.POSITION); | 491 | part.TriggerScriptChangedEvent(Changed.POSITION); |
492 | } | ||
493 | } | ||
494 | if (!m_dupeInProgress) | ||
495 | { | ||
496 | foreach (ScenePresence av in m_linkedAvatars) | ||
497 | { | ||
498 | Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; | ||
499 | av.AbsolutePosition += offset; | ||
500 | av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition | ||
501 | av.SendFullUpdateToAllClients(); | ||
482 | } | 502 | } |
483 | } | ||
484 | if (!m_dupeInProgress) | ||
485 | { | ||
486 | foreach (ScenePresence av in m_linkedAvatars) | ||
487 | { | ||
488 | Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition; | ||
489 | av.AbsolutePosition += offset; | ||
490 | av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition | ||
491 | av.SendFullUpdateToAllClients(); | ||
492 | } | ||
493 | } | 503 | } |
494 | 504 | ||
495 | //if (m_rootPart.PhysActor != null) | 505 | //if (m_rootPart.PhysActor != null) |
@@ -1805,95 +1815,95 @@ namespace OpenSim.Region.Framework.Scenes | |||
1805 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> | 1815 | /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param> |
1806 | /// <returns></returns> | 1816 | /// <returns></returns> |
1807 | public SceneObjectGroup Copy(bool userExposed) | 1817 | public SceneObjectGroup Copy(bool userExposed) |
1808 | { | 1818 | { |
1809 | SceneObjectGroup dupe; | 1819 | SceneObjectGroup dupe; |
1810 | try | 1820 | try |
1811 | { | 1821 | { |
1812 | m_dupeInProgress = true; | 1822 | m_dupeInProgress = true; |
1813 | dupe = (SceneObjectGroup)MemberwiseClone(); | 1823 | dupe = (SceneObjectGroup)MemberwiseClone(); |
1814 | dupe.m_isBackedUp = false; | 1824 | dupe.m_isBackedUp = false; |
1815 | dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); | 1825 | dupe.m_parts = new Dictionary<UUID, SceneObjectPart>(); |
1816 | 1826 | ||
1817 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of | 1827 | // Warning, The following code related to previousAttachmentStatus is needed so that clones of |
1818 | // attachments do not bordercross while they're being duplicated. This is hacktastic! | 1828 | // attachments do not bordercross while they're being duplicated. This is hacktastic! |
1819 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! | 1829 | // Normally, setting AbsolutePosition will bordercross a prim if it's outside the region! |
1820 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state | 1830 | // unless IsAttachment is true!, so to prevent border crossing, we save it's attachment state |
1821 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, | 1831 | // (which should be false anyway) set it as an Attachment and then set it's Absolute Position, |
1822 | // then restore it's attachment state | 1832 | // then restore it's attachment state |
1823 | 1833 | ||
1824 | // This is only necessary when userExposed is false! | 1834 | // This is only necessary when userExposed is false! |
1825 | 1835 | ||
1826 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; | 1836 | bool previousAttachmentStatus = dupe.RootPart.IsAttachment; |
1827 | 1837 | ||
1828 | if (!userExposed) | 1838 | if (!userExposed) |
1829 | dupe.RootPart.IsAttachment = true; | 1839 | dupe.RootPart.IsAttachment = true; |
1830 | 1840 | ||
1831 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); | 1841 | dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); |
1832 | 1842 | ||
1833 | if (!userExposed) | 1843 | if (!userExposed) |
1834 | { | 1844 | { |
1835 | dupe.RootPart.IsAttachment = previousAttachmentStatus; | 1845 | dupe.RootPart.IsAttachment = previousAttachmentStatus; |
1836 | } | 1846 | } |
1837 | 1847 | ||
1838 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 1848 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
1839 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 1849 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
1840 | 1850 | ||
1841 | if (userExposed) | 1851 | if (userExposed) |
1842 | dupe.m_rootPart.TrimPermissions(); | 1852 | dupe.m_rootPart.TrimPermissions(); |
1843 | 1853 | ||
1844 | /// may need to create a new Physics actor. | 1854 | /// may need to create a new Physics actor. |
1845 | if (dupe.RootPart.PhysActor != null && userExposed) | 1855 | if (dupe.RootPart.PhysActor != null && userExposed) |
1846 | { | 1856 | { |
1847 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; | 1857 | PrimitiveBaseShape pbs = dupe.RootPart.Shape; |
1848 | 1858 | ||
1849 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( | 1859 | dupe.RootPart.PhysActor = m_scene.PhysicsScene.AddPrimShape( |
1850 | dupe.RootPart.Name, | 1860 | dupe.RootPart.Name, |
1851 | pbs, | 1861 | pbs, |
1852 | dupe.RootPart.AbsolutePosition, | 1862 | dupe.RootPart.AbsolutePosition, |
1853 | dupe.RootPart.Scale, | 1863 | dupe.RootPart.Scale, |
1854 | dupe.RootPart.RotationOffset, | 1864 | dupe.RootPart.RotationOffset, |
1855 | dupe.RootPart.PhysActor.IsPhysical); | 1865 | dupe.RootPart.PhysActor.IsPhysical); |
1856 | 1866 | ||
1857 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; | 1867 | dupe.RootPart.PhysActor.LocalID = dupe.RootPart.LocalId; |
1858 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); | 1868 | dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); |
1859 | } | 1869 | } |
1860 | 1870 | ||
1861 | List<SceneObjectPart> partList; | 1871 | List<SceneObjectPart> partList; |
1862 | 1872 | ||
1863 | lockPartsForRead(true); | 1873 | lockPartsForRead(true); |
1864 | 1874 | ||
1865 | partList = new List<SceneObjectPart>(m_parts.Values); | 1875 | partList = new List<SceneObjectPart>(m_parts.Values); |
1866 | 1876 | ||
1867 | lockPartsForRead(false); | 1877 | lockPartsForRead(false); |
1868 | 1878 | ||
1869 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) | 1879 | partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2) |
1870 | { | 1880 | { |
1871 | return p1.LinkNum.CompareTo(p2.LinkNum); | 1881 | return p1.LinkNum.CompareTo(p2.LinkNum); |
1872 | } | 1882 | } |
1873 | ); | 1883 | ); |
1874 | 1884 | ||
1875 | foreach (SceneObjectPart part in partList) | 1885 | foreach (SceneObjectPart part in partList) |
1876 | { | 1886 | { |
1877 | if (part.UUID != m_rootPart.UUID) | 1887 | if (part.UUID != m_rootPart.UUID) |
1878 | { | 1888 | { |
1879 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); | 1889 | SceneObjectPart newPart = dupe.CopyPart(part, OwnerID, GroupID, userExposed); |
1880 | 1890 | ||
1881 | newPart.LinkNum = part.LinkNum; | 1891 | newPart.LinkNum = part.LinkNum; |
1882 | } | 1892 | } |
1883 | } | 1893 | } |
1884 | 1894 | ||
1885 | if (userExposed) | 1895 | if (userExposed) |
1886 | { | 1896 | { |
1887 | dupe.UpdateParentIDs(); | 1897 | dupe.UpdateParentIDs(); |
1888 | dupe.HasGroupChanged = true; | 1898 | dupe.HasGroupChanged = true; |
1889 | dupe.AttachToBackup(); | 1899 | dupe.AttachToBackup(); |
1890 | 1900 | ||
1891 | ScheduleGroupForFullUpdate(); | 1901 | ScheduleGroupForFullUpdate(); |
1892 | } | 1902 | } |
1893 | } | 1903 | } |
1894 | finally | 1904 | finally |
1895 | { | 1905 | { |
1896 | m_dupeInProgress = false; | 1906 | m_dupeInProgress = false; |
1897 | } | 1907 | } |
1898 | return dupe; | 1908 | return dupe; |
1899 | } | 1909 | } |