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!

RunUO holds on save when using DynamicSaveStrategy

Soteric

Knight
Hello. RunUO is running on CentOS
Code:
$uname -a && cat /etc/issue
Linux 2.6.32-220.13.1.el6.x86_64 #1 SMP Tue Apr 17 23:56:34 BST 2012 x86_64 x86_64 x86_64 GNU/Linux
CentOS release 6.2 (Final)
When trying to perform world save the RunUO process stops responding. The last message is
Code:
Core: Using dynamic save strategy
World: Saving...
kill -QUIT gives the following thread dump
Code:
Full thread dump:

"Threadpool worker" tid=0x0x7f5a9423c700 this=0x0x7f5aa6876ea0 thread handle 0x439 state : interrupted state owns ()
  at (wrapper managed-to-native) System.IO.MonoIO.Write (intptr,byte[],int,int,System.IO.MonoIOError&) <0xffffffff>
  at System.IO.FileStream.WriteInternal (byte[],int,int) <0x0006f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_int_int (object,intptr,intptr,intptr) <0xffffffff>

"IO Threadpool worker" tid=0x0x7f5ab824a700 this=0x0x7f5a97070138 thread handle 0x419 state : interrupted state owns ()

"Threapool monitor" tid=0x0x7f5aba3f7700 this=0x0x7f5ac43e9270 thread handle 0x413 state : interrupted state owns ()

"Threadpool worker" tid=0x0x7f5aba160700 this=0x0x7f5ac43e9750 thread handle 0x414 state : interrupted state owns ()
  at (wrapper managed-to-native) System.Threading.Monitor.try_enter_with_atomic_var (object,int,bool&) <0xffffffff>
  at System.Threading.Monitor.TryEnter (object,int,bool&) <0x0004f>
  at System.Threading.Monitor.Enter (object,bool&) <0x00023>
  at Server.Network.NetState.OnReceive (System.IAsyncResult) <0x0019f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>

"Core Thread" tid=0x0x7f5ac43f5740 this=0x0x7f5ac43e9ea0 thread handle 0x403 state : waiting on 0x431 : Event  owns ()
  at (wrapper managed-to-native) System.Threading.WaitHandle.WaitOne_internal (System.Threading.WaitHandle,intptr,int,bool) <0xffffffff>
  at System.Threading.WaitHandle.WaitOne () <0x0006b>
  at Server.FileQueue.Flush () <0x0007f>
  at Server.SequentialFileWriter.Flush () <0x0001b>
  at Server.SequentialFileWriter.Dispose (bool) <0x00028>
  at System.IO.Stream.Close () <0x00018>
  at Server.DynamicSaveStrategy.CloseFiles () <0x0001a>
  at Server.DynamicSaveStrategy.Save (Server.SaveMetrics,bool) <0x0011b>
  at Server.World.Save (bool,bool) <0x001a9>
  at Server.Misc.AutoSave.Save (bool) <0x00083>
  at Server.Misc.AutoSave.Save () <0x0000b>
  at Server.Commands.CommandHandlers.Save_OnCommand (Server.Commands.CommandEventArgs) <0x0000b>
  at Server.Commands.CommandSystem.Handle (Server.Mobile,string,Server.Network.MessageType) <0x001c8>
  at Server.Mobile.DoSpeech (string,int[],Server.Network.MessageType,int) <0x00083>
  at Server.Mobiles.PlayerMobile.DoSpeech (string,int[],Server.Network.MessageType,int) <0x001fb>
  at Server.Network.PacketHandlers.UnicodeSpeech (Server.Network.NetState,Server.Network.PacketReader) <0x00298>
  at Server.Network.MessagePump.HandleReceive (Server.Network.NetState) <0x00563>
  at Server.Network.MessagePump.Slice () <0x000bf>
  at Server.Core.Main (string[]) <0x00d7b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

"Timer Thread" tid=0x0x7f5ab8209700 this=0x0x7f5ac43e99c0 thread handle 0x41b state : interrupted state owns ()
  at (wrapper managed-to-native) System.Threading.WaitHandle.WaitOne_internal (System.Threading.WaitHandle,intptr,int,bool) <0xffffffff>
  at System.Threading.WaitHandle.WaitOne (int,bool) <0x00087>
  at Server.Timer/TimerThread.TimerMain () <0x002df>
  at System.Threading.Thread.StartUnsafe () <0x00071>
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <0xffffffff>

"Threadpool worker" tid=0x0x7f5a9443d700 this=0x0x7f5aa6850c30 thread handle 0x437 state : interrupted state owns ()
  at (wrapper managed-to-native) System.IO.MonoIO.Write (intptr,byte[],int,int,System.IO.MonoIOError&) <0xffffffff>
  at System.IO.FileStream.WriteInternal (byte[],int,int) <0x0006f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_int_int (object,intptr,intptr,intptr) <0xffffffff>

"Threadpool worker" tid=0x0x7f5a84303700 this=0x0x7f5aa68764e0 thread handle 0x43f state : interrupted state owns ()
  at (wrapper managed-to-native) System.IO.MonoIO.Write (intptr,byte[],int,int,System.IO.MonoIOError&) <0xffffffff>
  at System.IO.FileStream.WriteInternal (byte[],int,int) <0x0006f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_int_int (object,intptr,intptr,intptr) <0xffffffff>

"<threadpool thread>" tid=0x0x7f5ab828b700 this=0x0x7f5a97070270 thread handle 0x418 state : interrupted state owns ()
I narrowed down the problem to the following piece of code. DynamicSaveStrategy.cs, it holds on highlighted line. If I switch items and mobiles it holds on mobiles then.
Rich (BB code):
		private void CloseFiles()
		{
			_itemData.Close();
			_itemIndex.Close();

			_mobileData.Close();
			_mobileIndex.Close();

			_guildData.Close();
			_guildIndex.Close();
		}
I checked FileQueue.cs Flush method where it enters the waiting state.
Rich (BB code):
		public void Flush() {
			if ( buffered.buffer != null ) {
				Append( buffered );

				buffered.buffer = null;
				buffered.length = 0;
			}

			/*lock ( syncRoot ) {
				if ( pending.Count > 0 ) {
					idle.Reset();
				}

				for ( int slot = 0; slot < active.Length && pending.Count > 0; ++slot ) {
					if ( active[slot] == null ) {
						Page page = pending.Dequeue();

						active[slot] = new Chunk( this, slot, page.buffer, 0, page.length );

						++activeCount;

						callback( active[slot] );
					}
				}
			}*/

			idle.WaitOne();
		}
It seems that 'idle' should be reset in Append method or somewhere before Flush is invoked but it doesn't happen. Some additional information:
- It works on Windows with the same save strategy and the same world;
- Distro RunUO SVN works on Linux with the same save strategy but with empty world.

Any ideas would be very helpful.
 
Top