Random "time speed" happening during game

linkylinky Join Date: 2013-01-02 Member: 177159Members
edited January 2013 in Server Discussion
Hi there,

I created a dedicated server that is fully running except the fact that we are getting some kind of "time speed" during the game which is making MAC teleporting, alien upgrades instantly finishing and creep instantly max expanding. We can see on the game timer increasing instantly which might explain why all of this things happens but we don't get why it's happening. Does anyone had the same issue?

From hardware point of view: We have vitualized on main server with Xeon E3-1225 3,2Ghz with 16GB RAM and 4 cores on Debian using QEMU. The virtualized server is a Windows 2008R2 with 2 cores and 4GB RAM.
The Windows server is only starting the dedicated server and nothing else. On the Debian (main server hosting VM), there is close to nothing except a TS3 server and QEMU.
To ensure it is not a hardware issue, we added 1 extra core and more RAM but the effect was exactly the same.

About the NS2 dedicated server, we had DAK mod installed but to ensure it is not the mod, we tested with a fresh new dedicated server and symptom is the same.

I'm really getting out of ideas.

Thanks for your help!

Comments

  • MiniH0wieMiniH0wie Join Date: 2007-11-25 Member: 63013Members
    Turn off the speed hack!


    ;)
    j/k, that is a really strange problem.
  • krazekraze Join Date: 2012-10-26 Member: 163744Members
    Not something I've seen before but it may be worth downloading a fresh copy of the dedicated server to make sure there is nothing wrong with the install. You may also want to check your log files and see if it has any output about that.
  • linkylinky Join Date: 2013-01-02 Member: 177159Members
    edited January 2013
    Thanks for your replies.

    Logs are empty and I installed a complete new copy from SteamCMD withhout any old config file. Problem is the same :(

    Logs below (I removed connect/disconnect and steam ids). It happens quite fast. Already after 5 minutes I have 7 minutes ingame. It's an increase of approximatively 45/50 seconds when the random speed ticks.

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Date: 01/03/13
    Time: 20:14:28
    --------------------------------------------------------------
    Build 235
    Connected to Steam servers
    VAC Enabled
    Loading config://ServerConfig.json
    Loading config://ServerAdmin.json
    Loading config://BannedPlayers.json
    Loading config://MapCycle.json
    Loading config://ConsistencyConfig.json
    Hashed 1 game_setup.xml files for consistency
    Hashed 648 *.lua files for consistency
    Hashed 33 *.fx files for consistency
    Hashed 13 *.screenfx files for consistency
    Hashed 64 *.surface_shader files for consistency
    Hashed 3 *.fxh files for consistency
    Hashed 2 *.render_setup files for consistency
    Hashed 2 *.shader_template files for consistency
    Loading 'maps/ns2_veil.level'
    Building pathing mesh for level maps/ns2_veil.level
    Finished loading 'maps/ns2_veil.level'
    Error: Couldn't open file 'models/props/refinery/refinery_fan128_blades.animation_graph'<!--c2--></div><!--ec2-->

    Additionally, I'm starting the server this way:
    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->C:\ns2server\Server.exe -file "C:\ns2server\config\server.txt"<!--c2--></div><!--ec2-->

    And the server.txt is like this:
    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->-config_path "C:\ns2server\config" -map ns2_veil -limit 15 -name "Testing issue NS2 Server"<!--c2--></div><!--ec2-->
  • krazekraze Join Date: 2012-10-26 Member: 163744Members
    Is the server overloaded at all, Are ticks dropping?
  • RothgarRothgar Join Date: 2009-11-13 Member: 69372Members
    Have you tried a different virtualization platform? Such as VMware Server?

    I don't know why NS2 is struggling but it seems these type of issues are because of virtualization?

    <a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=126568" target="_blank">http://www.unknownworlds.com/ns2/forums/in...howtopic=126568</a>

    I haven't used QEMU in a long time, but I found VMware seemed to have the better performance when dealing with heavy load guests.

    The other virtualization you could try is VirtualBox
  • linkylinky Join Date: 2013-01-02 Member: 177159Members
    edited January 2013
    Not at all. Everything is working fine but at some time, Time instantly increases something around 45s more. Instead of having whole game at 20 minutes (real time) the game displays 35 minutes at the end so it occurs quite oftently.
  • RothgarRothgar Join Date: 2009-11-13 Member: 69372Members
    Different applications handle time synchronization differently. I have no idea how UWE handle these type of things.

    As an example, I had a problem with a media application that needed to take song request, it then added the song to the queue at the time the request came in + the length of the song and wanted to play the song at that particular time. However the guest time was not 100% and so at the time it was supposed to queue I expect a song was still playing and the request never played and I ended up with a massive request queue.

    I believe this issue was fixed once I went through the kernel messages of VMware and identified that a host kernel module I believe to do with time synchronization was not running.

    I didn't use QEMU for long so no idea what type of logging it uses, in either case I would suggest trying different hypervisor or look into time synchronization.
  • linkylinky Join Date: 2013-01-02 Member: 177159Members
    edited January 2013
    I found out someone using kind of same configuration with exact same behavior :
    <a href="http://www.unknownworlds.com/ns2/forums/index.php?showtopic=126568" target="_blank">http://www.unknownworlds.com/ns2/forums/in...howtopic=126568</a>

    EDIT: According to other post KVM can be used with QEMU so might come from this with 2008r2. Which is really weird because except this behavior everything is working fine on the VM :(
  • CaradasCaradas Join Date: 2005-04-08 Member: 47826Members
    hey :) i think we use the same virtualisation system. I use qemu too, but with kvm backend.
    I think you also use this backend because qemu without hardware virtualisation is horribly slow.



    i could lower the issue a bit with some config modifications.

    <ul>bind the virtual cpu process to a hardware cpu.
    forcing the server.exe to use only one core (and as second the related hyperthreading core).
    increasing the process priority of these processes to -1 at the hypervisor.
    increase the priority of the i/o process (for the vm, at the hypervisor) to -1.</li></ul>

    i notified that the bug mostly happens when the process is jumping around from one core to another cores or if the hypervisor has some other work for this core/thread of the cpu.
  • linkylinky Join Date: 2013-01-02 Member: 177159Members
    edited January 2013
    Many thanks for your reply :)

    It indeed looks like it's buggy when it is switching between CPUs.

    I'll take a look and I'll reply once I got some time to play with QEMU/KVM (indeed I'm using it through KVM for performance).

    Cheers
  • CaradasCaradas Join Date: 2005-04-08 Member: 47826Members
    so now i tried a few config changes.

    i set the cpu governor to performance at the host machine (to fix the cpu frequency).

    and also i noticed that the clock on the windows guest runs to slow.
    my linux vm reported me a lower cpu frequency as the host have. windows reports this too.

    if the clock calculation is based on the cpu frequency it would explain the bugs.

    there are a few possibilities to make a time based action with computers.

    one of them is: get the actual time at the starting event and add the duration to it. now save this value and check if the saved value is lower than the actual time.
    number to is: calculate the cycles that you need to reach the duration time. let start a second value with 0 and add 1 every cycle.

    i don't know how windows calculate the actual time. if its based on the cpu frequency with a check to the hardware clock after some time the following should happen:

    you start an upgrade. the server gets the actual time, add the upgrade duration to it and save it. now check on every tick if the actual time reached the saved time. -till here is everything normal- NOW windows miscalculated the actual time. the server get this wrong time and check it with the saved time. if its "later" then the saved time the upgrade finishes, because the server don't know that the time is wrong.


    anyone know how to configure kvm to transfer the correct cpu frequency to the guest?
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    NS2 uses QueryPerformanceCounter/Frequency for its internal timekeeping. It does assume a stable frequency, so if the CPU frequency changes after the game starts, things will go weird.
  • CaradasCaradas Join Date: 2005-04-08 Member: 47826Members
    edited January 2013
    is there a start parameter to force a specific frequency at the ns2 server?
    i need this because kvm transmitts the wrong cpu frequency to the guests.
    <img src="http://i.imgur.com/zRHnZ.png" border="0" class="linked-image" />
  • RothgarRothgar Join Date: 2009-11-13 Member: 69372Members
    <!--quoteo(post=2062232:date=Jan 18 2013, 07:55 AM:name=Caradas)--><div class='quotetop'>QUOTE (Caradas @ Jan 18 2013, 07:55 AM) <a href="index.php?act=findpost&pid=2062232"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->is there a start parameter to force a specific frequency at the ns2 server?
    i need this because kvm transmitts the wrong cpu frequency to the guests.
    <img src="http://i.imgur.com/zRHnZ.png" border="0" class="linked-image" /><!--QuoteEnd--></div><!--QuoteEEnd-->

    I would try another hyper-visor like VMware, which VMware Server AFAIK is free.

    The difference in clock speed is going to be hard to diagnose but if you are using turbo-stepping etc from the BIOS then the clock speeds are variable and I would have no idea how QEMU would handle this or other hyper-visors but some might be better than others.

    You could try disable those CPU features but then in NS you want faster clock-speed so...

    That said it could just be a missing kernel module I did a lot of research in the past when I was looking at optimizing a home VM setup and I tried QEMU, VirtualBox, VMware and performance-wise at that time VMware was better (Lower CPU usage on real-time audio encoding) but along the way I was having trouble with time issues where the guest would lapse in time, I recall fixing this with a missing kernel module but I had to trawl through the VM logs to see errors etc and fix them.
  • linkylinky Join Date: 2013-01-02 Member: 177159Members
    Hi there,

    Sorry for answering so late but couldn't find time to work on that.
    Now, I tried all things around that were explained in this topic and couldn't achieve anything.

    I then decided to try VMWare which was a paint if you want to install it without GUI.
    So finally, I tried with Virtualbox and it is now fixed and working perfectly!

    So conclusion, there is definately an issue with KVM/QEMU while running a NS2 server :(

    Cheers
  • CaradasCaradas Join Date: 2005-04-08 Member: 47826Members
    Thanks ;)

    But VMWare Server has one Problem for me. It supports only 2 VCPU per guest.

    So i hope UWE or KVM Devs get this bug fixed.
  • linkylinky Join Date: 2013-01-02 Member: 177159Members
    I'm using Virtualbox. You can get more than 2 VCPU AFAIK :)
  • CaradasCaradas Join Date: 2005-04-08 Member: 47826Members
    i've found a possible fix for the problem,

    libvirt has .xml files witch defines the virtual machine.
    At this file is a section called <cpu>, if you set this to
    <cpu mode='host-passthrough'/>
    
    the timebug is gone!.... BUT windows 2008 won't start with this option. also the installer causes a bsod. Windows XP works fine.

  • amkiamki Join Date: 2013-04-24 Member: 184965Members
    Windows Server 2008 R2 x64 did not crash for me when using host-passthrough but it didn't solve the problem either...
    Other suggestions?
Sign In or Register to comment.