Running a Server

MapRecover: Restore the Map After a Killing Floor Server Crash

When a Killing Floor server crashes on a map change, a restart script brings it back on the map from its command line, not the one players just voted for. Somebody then has to ask an admin to switch maps again. MapRecover fixes this: after a restart it loads the map players were going to, and falls back to a safe default if that map keeps crashing.

The mutator was published on the Tripwire forums (showthread.php?t=66785) and adapted for Russian server owners on killingfloor.ru in 2011.

What you need

  • A dedicated server started from a restart loop (a .bat file on Windows). MapRecover does not restart the process, it only decides which map to load after a restart.
  • The MapRecover.u package in System. The original download was KFMapRecover.rar from klankaos.com. That host is long gone, so look for an archived copy or the original Tripwire thread.

Installation

  1. Unpack the mutator into the server's System folder.
  2. In KillingFloor.ini, find the ServerActors lines and add MapRecover below them:
ServerActors=IpDrv.MasterServerUplink
ServerActors=UWeb.WebServer
ServerActors=MapRecover.MapRecover

Do not replace the existing lines. The first version of the instructions said to remove MasterServerUplink and WebServer. Server owners who did that ended up with a server missing from the browser and Favorites ("no response from server") and a dead WebAdmin.

  1. Start the server on the empty Entry level with no map and no mutators on the command line. MapRecover reads the real start options from its own ini:
ucc server Entry?Game=Engine.GameInfo?VACSecured=true?MaxPlayers=6?ini=killingfloor.ini

MapRecover.ini

[MapRecover.MapRecover]
FallbackURL=KF-Canville.rom?game=KFmod.KFGameType?VACSecured=True?MaxPlayers=6?Mutator=ServerPerksV4.ServerPerksMut,KFBruteMut.KFBruteMut
MaxFailureCount=1
  • FallbackURL is the server's normal start configuration (map, game type, mutators). It is used on the first start and whenever the saved map turns out to be broken.
  • MaxFailureCount limits how many failed attempts on the saved map are tolerated before the server falls back to FallbackURL, judging by the name. The forum example uses 1.
  • SavedURL is written by the mutator after the first run. It holds the current map, or the map players voted for when the server crashed during the change.

Adding mutators: they now go into FallbackURL in MapRecover.ini, not into the batch file. After changing the mutator list, delete every line after MaxFailureCount=1 (the saved SavedURL and counters). Otherwise the server keeps restoring the old URL with the old mutator list.

Restart loop example

@echo off
cls
title KF AntiCrash
:loop
echo (%time%) KF server started.
start /wait ucc server Entry?Game=Engine.GameInfo?VACSecured=true?MaxPlayers=6?ini=killingfloor.ini
echo (%time%) WARNING: server closed or crashed, restarting...
goto loop

start /wait blocks until ucc exits, then goto loop starts it again. MapRecover takes care of the map.

Known problems

ProblemCause / fix
Server not visible in Favorites or the browser, WebAdmin unavailableMasterServerUplink and WebServer were removed from ServerActors. Put them back and keep MapRecover as an additional line
Players see the map name as "Entry" and crash on connectThe server stayed on the Entry level: MapRecover was not loaded (wrong package name, file not in System) or FallbackURL is invalid. Check the server log right after start
The server keeps returning to an old mutator setStale SavedURL in MapRecover.ini. Clear the lines after MaxFailureCount
On startup the server prints MapRecover: *** Server has crashed, returning to: ... 2-3 times in a row, then starts normallyCase from the killingfloor.ru forum thread "Сервер несколько раз крашится при старте": a server with its own game type from a ServerPerks package. Removing the MapRecover mutator fixed it

MapRecover treats the symptom. If the server crashes on every change to a particular map, find the cause in the log. Some custom maps are known to crash dedicated servers after a map restart.

Finding the cause of crashes on map change

Tips from the thread "Падение сервера после смены карты" (Server crashes after a map change, killingfloor.ru forum, 2011). There the server crashed after the map vote, more often the more players there were (8-10 and up), and never at night on an empty server:

  • One mutator at a time. Disable everything "extra" and enable mutators one by one until the server crashes. To double-check, enable them in a different order, and also everything except the suspect. Remove mutators that may conflict with each other first (in that thread it was the DOOM III mutator).
  • Missing map files. If crashes only happen on custom maps, make sure the server has not just the .rom but every extra package the map needs (textures and so on). Without them players get kicked on the vote, and after a long wait the server switches to another map.
  • A clean test. Back up the settings and reset everything to defaults, or install a clean server into a separate folder without deleting the old one and test it with minimal changes. If that one crashes too, look for the cause in the system.
  • In the end the thread author installed MapRecover: according to him, players are no longer kicked when the server crashes, and the map changes as it should.

In a later thread, "Падение после смены карты" (Crash after a map change, killingfloor.ru forum, 2012), the server shut down overnight on a map switch; the end of ucc.log showed a chain of Critical: UObject::GetPathName lines, then UObject::PurgeGarbage, UGameEngine::LoadMap and ServerTravel. LLIePLLIeHb found that the hang depended neither on mutators nor on the crack, and not on the size of the .rom file, but on specific maps. Maps that reliably brought the server down for him: KF-AtlasB1, KF-Barzakh, KF-PhantomCastleB5, KF-MuskratCastle. Changing ServerTravelPause did not help. In his view the problem appeared with one of the patches (around 1032); MaThreeX wrote that MapRecover saved the day in such cases.