RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Server crash, ArgumentOutOfRangeException

Shulio

Wanderer
Server crash, ArgumentOutOfRangeException

Code:
Server Crash Report
===================

RunUO Version 2.1, Build 3785.34766
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 3
.NET Framework: 2.0.50727.3053
Time: 2010-06-01 11:17:27
Mobiles: 37302
Items: 183999
Exception:
System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
Parameter name: t
   at System.DateTime.op_Addition(DateTime d, TimeSpan t)
   at Server.Timer.TimerThread.ProcessChangeQueue()
   at Server.Timer.TimerThread.TimerMain()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Clients:
- Count: 0


Hello!

My friends and I have been playing UO for the past few weeks, yesterday night I noticed that the server started to run a bit slowly (and it felt like the autosaves got more frequent and slower).

So I thought that I should restart the server, but all of sudden I get this error, and I have absolutely no idea what it means. Im really not the type that goes to a forum to ask for help though I am totally lost in this one. Ive been trying to get it to work for a couple of hours but with no success. Couldnt find anything when using the search function on the forum either.

Apparently, if I delete the mobiles folder in the Saves the server will start up but everything is just a mess.
I am using the RunUO with mondains legacy SVN.

If anyone could help me fix this problem I would appreciate it alot.
 

Thagoras

Sorceror
Well, for the time being (just before I leave for work) I would suggest running your server in -debug mode to see exactly (as far as possible) what is causing the crash. This should inform you of not only the offending script but the line number. It's possible that it's a save file (audible groan...I've been having this happen more and more frequently lately) in which case it is possible to recover from a previous save...however, if, as you've said, it was saving, just taking its jolly time about it, the issue will probably infect those saves too.

If you CAN find a save that works. You may have an excess quantity of items or mobiles which exist but don't and need to be 'cleaned' up. I forget the exact way to say this, but I recall a few months ago there was a post about this. Lord Greywolf, I think, made a comment about it...so he may remember what I'm talking about. Like, when you have a line of code which is something like Mobile m = new WaterElemental(); and then you neither bring to world that mobile, and don't delete it, it still exists as m, taking up space and slowing the server.....and I wonder if this might be what you're experiencing.
 

Soteric

Knight
Shulio kindly provided his server sources and saves for testing. I've add some debug code in Timer class
Rich (BB code):
try
{
	timer.m_Next = DateTime.Now + timer.m_Delay;
}
catch
{
	Console.WriteLine( "TimerException caught: {0}, Delay = {1}", timer.ToString(), timer.m_Delay );
}
and got this
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = 4182672.21:41:42.5687808
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -8318789.09:37:53.4312192
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -1683069.04:30:49.4312192
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = 4228496.11:09:58.5687808
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = 10403208.15:08:01.5239424
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = 10269575.20:55:45.5239424
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -6016355.00:27:37.4312192
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -1679686.04:41:29.4312192
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -1681873.18:18:33.4312192
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -7977434.20:45:45.4312192
TimerException caught: Server.Mobiles.BaseCreature+DeleteTimer, Delay = -1680462.22:02:33.4312192
So Delay value isn't correct and gives exception when add to DateTime.Now. I haven't managed to find why those values could be passed to delete timer though. I hope developers take a look on it.

ADDED: These Delay values come from deserialize method.

ADDED: As a workaround I suggest to filter incorrect values on deserialization. So in void Deserialize( GenericReader reader ) method of BaseCreature class this code
Code:
if (deleteTime == TimeSpan.Zero)
	deleteTime = TimeSpan.FromDays(3.0);
should be this I guess
Rich (BB code):
if( deleteTime <= TimeSpan.Zero || deleteTime > TimeSpan.FromDays( 3.0 ))
	deleteTime = TimeSpan.FromDays( 3.0 );
 

Shulio

Wanderer
Thanks alot!

At last me and my friend can play Ultima together again!

I truly appreciate every piece of help you've given me.

Now, back to hunt some treasure! :D
 

clarissa

Sorceror
server crash

Oh sweet. I was having same problem for a few days. I was able to do a backup and get in then this morning nothing worked. This has helped a great deal. :D
 

Pure Insanity

Sorceror
I just recently had to add this mod to my server, no idea why it just randomly started doing it. But this fix worked...thanks for the post.
 

shackal

Sorceror
My problem is solve with this solution, but return with this code:
Code:
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
    [CorpseName( "a Navrey Night-Eyes" )]
    public class NavreyNightEyes : BaseCreature
    {
        [Constructable]
        public NavreyNightEyes () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
        {
            Name = "a Navrey Night Eyes";
            Body = 735;
            BaseSoundID = 1170;

            SetStr( 1000, 1500 );
            SetDex( 200, 250 );
            SetInt( 150, 200 );

            SetHits( 29000, 30000 );

            SetDamage( 25, 35 );

            SetDamageType( ResistanceType.Physical, 50 );
            SetDamageType( ResistanceType.Fire, 25 );
            SetDamageType( REsistanceType.Energy, 25);

            SetResistance( ResistanceType.Physical, 50, 60 );
            SetResistance( ResistanceType.Fire, 40, 50 );
            SetResistance( ResistanceType.Cold, 60, 70 );
            SetResistance( ResistanceType.Poison, 95, 100 );
            SetResistance( ResistanceType.Energy, 60, 80 );
  
            SetSkill( SkillName.EvalInt, 90.1, 100.0 );
            SetSkill( SkillName.Magery, 90.1, 100.0 );
            SetSkill( SkillName.Meditation, 80.1, 1000.0 );
            SetSkill( SkillName.MagicResist, 100.0, 130.0 );
            SetSkill( SkillName.Tactics, 90.0, 100.0 );
            SetSkill( SkillName.Wrestling, 90.0, 100.0 );
            SetSkill( SkillName.Anatomy, 50.0, 80.0);
            SetSkill( SkillName.Poisoning, 99.0, 100.0);

            Fame = 5000;//unknown
            Karma = -5000;//unknown

            VirtualArmor = 60;//unknown

            //PackItem( new SpidersSilk( 8 ) );
        }

        public override void GenerateLoot()
        {
            AddLoot( LootPack.FilthyRich );
        }

        public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
        public override Poison HitPoison{ get{ return Poison.Lethal; } }
        public override int TreasureMapLevel{ get{ return 4; } }

        public NavreyNightEyes( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
            writer.Write( (int) 0 );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();

            if ( BaseSoundID == 263 )
                BaseSoundID = 1170;
        }
    }
}
Maybe this code help someone to definitive solution.
 

Deimos

Page
Question, is this a flaw with the basecreature code? Or is it custom addons which cause the problem? I assume it's buggy/incorrect code with the core basecreature.cs file.
 

shackal

Sorceror
I dont know, i add this script and shard crash, but i was tested with others, and crash to.

Basecreature is not modified.
 
omgosh :) good debuging fellers no more curupted saves for me, (hopefully)
just a lil more detail, this is the basecreature.cs file somewhere around line 1923

if (version >= 18)
deleteTime = reader.ReadTimeSpan();
if (deleteTime > TimeSpan.Zero || LastOwner != null && !Controlled && !IsStabled)
{
if( deleteTime <= TimeSpan.Zero || deleteTime > TimeSpan.FromDays( 3.0 ))// Edit this line
deleteTime = TimeSpan.FromDays(3.0);
m_DeleteTimer = new DeleteTimer(this, deleteTime);
m_DeleteTimer.Start();
}
 
Top