Full Version : Xmlspawner corrupting save?
xmlspawner >>Troubleshooting >>Xmlspawner corrupting save?
<< Prev | Next >>
cheetah2003- 08-10-2006
I just got this Xmlspawner2 thing, because it looks really nice. Much better than Nerun's spawner.
Anyway. Here's the steps I took my shard.
I fired up [spawner on Nerun's thing, and cleared all the spawns from all facets.
Then, I ran [xmlimportmap to import all the Nerun's spawns into Xmlspawner2. Then I save.
Now I'm not sure exactly what it is I'm doing, but after a bit, when it goes to save, it coughs up an exception:

CODE
Exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at Server.StandardSaveStrategy.SaveItems(SaveMetrics metrics) in C:\Documents and Settings\Cheetah\My Documents\Visual Studio 2005\Projects\RunUO\RunUO\Persistence\StandardSaveStrategy.cs:line 111
at Server.StandardSaveStrategy.Save(SaveMetrics metrics) in C:\Documents and Settings\Cheetah\My Documents\Visual Studio 2005\Projects\RunUO\RunUO\Persistence\StandardSaveStrategy.cs:line 42
at Server.World.Save(Boolean message) in C:\Documents and Settings\Cheetah\My Documents\Visual Studio 2005\Projects\RunUO\RunUO\World.cs:line 725
at Server.World.Save() in C:\Documents and Settings\Cheetah\My Documents\Visual Studio 2005\Projects\RunUO\RunUO\World.cs:line 694
at Server.Misc.AutoSave.Save()
at Server.Misc.ServerConsole.Next(String nput)
at Server.Misc.ServerConsole.ConsoleListen(Object stateInfo)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

So, after several attempts to redo it all, I finally just pulled RunUO into my Visual Studio debugger.
Looks like an Xmlspawner2 is the culprit.

CODE
+ $exception {"Collection was modified; enumeration operation may not execute."} System.Exception {System.InvalidOperationException} + this {Server.StandardSaveStrategy} Server.StandardSaveStrategy + metrics null Server.SaveMetrics start 3572875 long
+ item {0x40014B5C "XmlSpawner"} Server.Item {Server.Mobiles.XmlSpawner}
+ items Count = 138070 System.Collections.Generic.Dictionary<Server.Serial,Server.Item>
+ decaying Count = 0 System.Collections.Generic.List<Server.Item>
+ idx {Server.BinaryFileWriter} Server.GenericWriter {Server.BinaryFileWriter}
+ tdb {Server.BinaryFileWriter} Server.GenericWriter {Server.BinaryFileWriter}
+ bin {Server.BinaryFileWriter} Server.GenericWriter {Server.BinaryFileWriter}

This is occuring in StandardSaveStrategy.cs, on line 111 (SVN 66), the only thing that strikes me as odd is that the item seems to be a mobile. I dunno what's up with that.
Anyway, any help would be appreciated.
ArteGordon- 08-10-2006
you might want to actually take a look at the spawner that it is complaining about
0x40014B5C
I will take a look and see how the World.Items.Values list might possibly be modified during serialization.
The distro spawners were originally put into the Mobile namespace I imagine because they were responsible for spawning mobiles. Xmlspawner was put into the same namespace just for consistency with the distro spawner convention.
(edit)
I dont see anything. Is it reproducible?
Were you running any other commands at or around the time of your save that might have started up a separate thread? That is the only thing that I can think of that might be modifying the list during a save.
cheetah2003- 08-10-2006
About the only thing I can think of that is consistant, is when I log into my mortal account and claim my packy. Always seems to happen after that.
It's definitely reproducable, so I can give you any further details you want. I'll see about pulling info on the spawner causing problem and posting again here.
Right now, I'm running my world save prior to converting everything over to Xmlspawner, but Xmlspawner is still fully installed, just dont have any of them in the world as of yet.
Hasn't crashed or corrupted my save since reverting to that save.
cheetah2003- 08-10-2006
OK, going through this step by step. Startting with a Nerun distro, and about 100 premium spawners I created myself. Start the server, login as owner, and using the spawner menu, I clear all spawners from all facets.
Then I'll run [xmlimportmap Data/Monsters
It tells me it imported 4935 spwaners from 80 .map files. Now I'll save and make another backup.
And restart the server, and save again just to be sure it still works. It does. Now I'll log into my mortal char and claim my packy from the stables (thats what I remember doing everytime before it puked on saving.)
And sure enough, I claim my packy, take 3 steps, then save, and it crashes. Precisely the same way.
Let me delve into that spawner that's invovled in the exception and post details here.

CODE
+ [Server.Mobiles.XmlSpawner] {0x40015CC9 "XmlSpawner"} Server.Mobiles.XmlSpawner Amount 1 int + BlessedFor null Server.Mobile BlocksFit false bool CanTarget true bool
ColdResistance 0 int
Decays false bool
+ DecayTime {01:00:00} System.TimeSpan
DefaultName null string
DefaultWeight 1.0 double
Deleted false bool
Direction North Server.Direction
DisplayLootType true bool
EnergyResistance 0 int
FireResistance 0 int
ForceShowProperties false bool
HandlesOnMovement false bool
HandlesOnSpeech false bool
+ HeldBy null Server.Mobile
Hue 0 int
HuedItemID 7964 int
InSecureTrade false bool
Insured false bool
IsLockedDown false bool
IsSecure false bool
IsVirtualItem false bool
+ ItemData {Server.ItemData} Server.ItemData
ItemID 7964 int
+ Items Count = 0 System.Collections.Generic.List<Server.Item>
LabelNumber 1027964 int
+ LastMoved {8/10/2006 1:29:14 PM} System.DateTime
Layer Invalid Server.Layer
Light ArchedWindowEast Server.LightType
+ Location {(1315, 2192, 0)} Server.Point3D
LootType Regular Server.LootType
m_Amount 1 int
+ m_CompactInfo {Server.Item.CompactInfo} Server.Item.CompactInfo
m_DeltaFlags None Server.ItemDelta
m_Direction North Server.Direction
m_Flags None Server.Item.ImplFlag
m_Hue 0 int
m_ItemID 7964 int
+ m_LastMovedTime {8/10/2006 1:29:14 PM} System.DateTime
m_Layer Invalid Server.Layer
+ m_Location {(1315, 2192, 0)} Server.Point3D
m_LootType Regular Server.LootType
+ m_Map {Trammel} Server.Map
+ m_OPLPacket null Server.Network.Packet
m_Parent null object
+ m_PropertyList null Server.ObjectPropertyList
+ m_RemovePacket null Server.Network.Packet
+ m_Serial {0x40015CC9} Server.Serial
m_Spawner null Server.ISpawner
m_TypeRef 379 int
+ m_WorldPacket null Server.Network.Packet
+ Map {Trammel} Server.Map
Movable false bool
Name "WildLife#68" string
+ OPLPacket {Server.OPLInfo} Server.Network.Packet {Server.OPLInfo}
Parent null object
ParentEntity null Server.IEntity
PayedInsurance false bool
PhysicalResistance 0 int
PileWeight 1 int
PoisonResistance 0 int
+ PropertyList {Server.ObjectPropertyList} Server.ObjectPropertyList
+ RemovePacket {Server.Network.RemoveItem} Server.Network.Packet {Server.Network.RemoveItem}
RootParent null object
RootParentEntity null Server.IEntity
SavedFlags 0 int
+ Serial {0x40015CC9} Server.Serial
+ Server.IEntity.Location {(1315, 2192, 0)} Server.Point3D
Server.ISerializable.SerialIdentity 1073831113 int
Server.ISerializable.TypeReference 379 int
Spawner null Server.ISpawner
Stackable false bool
TempFlags 0 int
TotalGold 0 int
TotalItems 0 int
TotalWeight 0 int
Visible false bool
Weight 1.0 double
+ WorldPacket {Server.Network.WorldItem} Server.Network.Packet {Server.Network.WorldItem}
X 1315 int
Y 2192 int
Z 0 int
+ Static members

CODE
+ base {0x40015CC9 "XmlSpawner"} Server.Item {Server.Mobiles.XmlSpawner} ActiveSectorCount 0 int AddSpawn null string AllowGhostTrig false bool AllowNPCTrig false bool
CanFreeSpawn true bool
CanSpawn true bool
ConfigFile null string
CurrentCount 1 int
Debug false bool
Decays false bool
+ DespawnTime {00:00:00} System.TimeSpan
DoDefrag false bool
DoReset false bool
DoRespawn false bool
+ Duration {00:00:00} System.TimeSpan
+ DurationOver {00:00:00} System.TimeSpan
ExternalTriggering false bool
ExtTrigState false bool
FastestPlayerSpeed 0 int
+ FirstModified {8/10/2006 1:27:18 PM} System.DateTime
FirstModifiedBy "Syvel" string
FreeRun false bool
+ GameTOD {01:28:00} System.TimeSpan
Group false bool
GumpState null string
HandlesOnMovement false bool
HandlesOnSkillUse false bool
HandlesOnSpeech false bool
HasActiveSectors false bool
HasDamagedOrDistantSpawns true bool
HasHoldSmartSpawning false bool
HoldSequence false bool
HomeRange 50 int
HomeRangeIsRelative false bool
IsFull false bool
IsInactivated false bool
KillCount 0 int
KillReset 1 int
+ LastModified {8/10/2006 1:27:18 PM} System.DateTime
LastModifiedBy "Syvel" string
LoadConfig false bool
m_IsInactivated false bool
m_killcount 0 int
+ m_SpawnObjects Count = 19 System.Collections.ArrayList
+ m_TextEntryBook null System.Collections.ArrayList
MaxCount 19 int
+ MaxDelay {00:10:00} System.TimeSpan
+ MinDelay {00:05:00} System.TimeSpan
+ MobTriggerId null Server.Mobile
MobTriggerName null string
MobTriggerProp null string
MoonPhase FirstQuarter Server.Items.MoonPhase
+ MostRecentSpawnPosition {(0, 0, 0)} Server.Point3D
MovingPlayerCount 0 int
NearbyPlayerCount 0 int
+ NextSeqReset {00:00:00} System.TimeSpan
+ NextSpawn {00:02:02.7500000} System.TimeSpan
NoTriggerOnCarried null string
OnHold false bool
PlayerCreated false bool
PlayerTriggerProp null string
+ PropertyInfoList null System.Collections.ArrayList
ProximityActivated false bool
ProximityMsg null string
ProximityRange -1 int
ProximitySound 500 int
RealDay 10 int
RealDayOfWeek Thursday System.DayOfWeek
RealMonth 8 int
+ RealTOD {13:33:57.0312500} System.TimeSpan
+ RecentItemSearchList null System.Collections.ArrayList
+ RecentMobileSearchList null System.Collections.ArrayList
+ RecentSpawnerSearchList null System.Collections.ArrayList
+ RefractMax {00:00:00} System.TimeSpan
+ RefractMin {00:00:00} System.TimeSpan
+ RefractoryOver {00:00:00} System.TimeSpan
RegionName null string
Running true bool
SafeCurrentCount 1 int
SafeTotalSpawnedObjects 1 int
SecCount 0 int
SequentialSpawn -1 int
+ SetItem null Server.Item
SetItemName null string
ShowBounds false bool
SingleSector false bool
SkillTrigger null string
SmartSpawning false bool
SomeOneHasGumpOpen false bool
+ SpawnerGump null Server.Mobiles.XmlSpawnerGump
+ SpawnObjects {Dimensions:[19]} Server.Mobiles.XmlSpawner.SpawnObject[]
SpawnOnTrigger false bool
SpawnRange 50 int
SpeechTrigger null string
StackAmount 1 int
status_str null string
Team 0 int
+ TOD {13:33:57.3281250} System.TimeSpan
+ TODEnd {00:00:00} System.TimeSpan
TODInRange true bool
TODMode Realtime Server.Mobiles.XmlSpawner.TODModeType
+ TODStart {00:00:00} System.TimeSpan
TotalSpawnedObjects 1 int
TotalSpawnObjectCount 87 int
TriggerAccessLevel Player Server.AccessLevel
+ TriggerMob null Server.Mobile
+ TriggerObject null Server.Item
TriggerObjectName null string
TriggerObjectProp null string
TriggerOnCarried null string
TriggerProbability 1.0 double
+ TriggerSkill null Server.Skill
UniqueId "28b3e656-6346-4fcb-aabc-e07a09bf0588" string
WayPoint null Server.Items.WayPoint
+ X1_Y1 {(1265, 2142, 0)} Server.Point3D
+ X2_Y2 {(1365, 2242, 0)} Server.Point3D
+ Static members
+ Non-Public members

What's interesting here, is it says modified it, but I never did any such thing. Unless converting from .map's counts as modifying it.
Not sure whatelse I can provide to be of more help, but it's 100% reproducable, so if there's other data you need, just let me know.
ArteGordon- 08-10-2006
the spawner information would be helpful and since it is reproducible, I would definitely like to try to track down the source of the problem.
ArteGordon- 08-10-2006
If you could save the spawner info to an XML file and then post that with a command like
[xmlsave badspawner.xml WildLife#68
cheetah2003- 08-10-2006

CODE
<Spawns> <Points> <Name>WildLife#68</Name> <UniqueId>28b3e656-6346-4fcb-aabc-e07a09bf0588</UniqueId> <Map>Trammel</Map>
<X>1265</X>
<Y>2142</Y>
<Width>100</Width>
<Height>100</Height>
<CentreX>1315</CentreX>
<CentreY>2192</CentreY>
<CentreZ>0</CentreZ>
<Range>50</Range>
<MaxCount>19</MaxCount>
<MinDelay>5</MinDelay>
<MaxDelay>10</MaxDelay>
<DelayInSec>False</DelayInSec>
<Duration>0</Duration>
<DespawnTime>0</DespawnTime>
<ProximityRange>-1</ProximityRange>
<ProximityTriggerSound>500</ProximityTriggerSound>
<TriggerProbability>1</TriggerProbability>
<InContainer>False</InContainer>
<MinRefractory>0</MinRefractory>
<MaxRefractory>0</MaxRefractory>
<TODStart>0</TODStart>
<TODEnd>0</TODEnd>
<TODMode>0</TODMode>
<KillReset>1</KillReset>
<ExternalTriggering>False</ExternalTriggering>
<SequentialSpawning>-1</SequentialSpawning>
<AllowGhostTriggering>False</AllowGhostTriggering>
<AllowNPCTriggering>False</AllowNPCTriggering>
<SpawnOnTrigger>False</SpawnOnTrigger>
<SmartSpawning>False</Smart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DN=-1:DX=-1:SP=1:PR=-1:OBJ=Eagle:MX=2:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=GreatHart:MX=2:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=Hind:MX=2:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=Bull:MX=2:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=Cow:MX=2:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1</Objects2>
</Points>
</Spawns>

ArteGordon- 08-10-2006
another question.
If you delete that spawner before saving, do you still get the crash?
cheetah2003- 08-10-2006
Not really sure if that's gunna be of any help. After collecting that data for you, I shutdown my server (didn't pull a packy this time) and it crashed again.
This time Sealife#32 is the spawner object in the exception. It's something else I think. Is it possible its interacting oddly with some of my other scripts?
I have things like Advanced Taming, Townhouses, Chat 3.0, Spellcrafting, Token system. Nerun's stuff is also all still present.
cheetah2003- 08-10-2006
Just for the heck of it, I'm going to wipe the server's save and repeat the steps again from a clean slate, and see what happens. Will post back.
ArteGordon- 08-10-2006

QUOTE (cheetah2003 @ August 10, 2006 04:06 pm)
Not really sure if that's gunna be of any help. After collecting that data for you, I shutdown my server (didn't pull a packy this time) and it crashed again. This time Sealife#32 is the spawner object in the exception. It's something else I think. Is it possible its interacting oddly with some of my other scripts?
I have things like Advanced Taming, Townhouses, Chat 3.0, Spellcrafting, Token system. Nerun's stuff is also all still present.

yes, I dont think the spawners are actually doing it, they just happen to be the items that are being saved at the time.
It really sounds like some kind of unsafe threading problem with one of those systems modifying the contents of World.Items during a save.
cheetah2003- 08-10-2006
I think my save was corrupted prior to this. It's just now starting to show up. Ugh. Starting fresh, I tried everything to crash it and it won't crash.
But thanks for all yer help! Hopefully I can track down the problems and get rid of them.
cheetah2003- 08-10-2006
Well, I was gunna start from scratch, but then it happened again while I was setting stuff up. Never experienced this problem until I started using Xmlspawner2. Wish I could figure out why it keeps happening. Oh well.
ArteGordon- 08-10-2006
I've never seen it before so I'm not sure what could be causing it. What are all of the custom systems that you have installed?