Merge pull request #1348 from CIB/master

Master controller crash debugging
This commit is contained in:
CIB
2012-06-21 19:20:10 -07:00
3 changed files with 61 additions and 45 deletions

View File

@@ -64,6 +64,7 @@ var/blobevent = 0
///////////////
var/diary = null
var/crashlog = null // Text file to store info in that might help with debugging crashes
var/diaryofmeanpeople = null
var/href_logfile = null
var/station_name = null

View File

@@ -3,6 +3,11 @@
/world/New()
..()
// Setup crashlog for debugging purposes
crashlog = file("crashlog.txt")
crashlog << "==========================================================\n"
crashlog << "** A new round has started.\n"
diary = file("data/logs/[time2text(world.realtime, "YYYY/MM-Month/DD-Day")].log")
diary << {"

View File

@@ -25,6 +25,7 @@ datum/controller/game_controller
setup()
setup_objects()
process()
set_debug_state(txt)
setup()
if(master_controller && (master_controller != src))
@@ -104,6 +105,12 @@ datum/controller/game_controller
world << "\red \b Initializations complete."
set_debug_state(txt)
// This should describe what is currently being done by the master controller
// Useful for crashlogs and similar, because that way it's easy to tell what
// was going on when the server crashed.
crashlog << "TickerState: [txt]"
process()
@@ -134,76 +141,79 @@ datum/controller/game_controller
powernets_ready = 0
ticker_ready = 0
// Wipe the crashlog every now and then to avoid it becoming too large
if(controller_iteration % 600 == 0)
del(crashlog)
fdel("crashlog.txt")
crashlog = file("crashlog.txt")
// the fact that the air master is not in the master controller
// will make it very hard to find out whether it's responsible
// for crashes
air_master_ready = 1
spawn(0)
// air_master.process()
air_master_ready = 1
spawn(0)
tension_master.process()
tension_master_ready = 1
src.set_debug_state("Tension Master")
tension_master.process()
tension_master_ready = 1
sleep(1)
spawn(0)
sun.calc_position()
sun_ready = 1
src.set_debug_state("Sun Position Calculations")
sun.calc_position()
sun_ready = 1
sleep(-1)
spawn(0)
for(var/mob/M in world)
M.Life()
mobs_ready = 1
src.set_debug_state("Mob Life Processing")
for(var/mob/M in world)
M.Life()
mobs_ready = 1
sleep(-1)
spawn(0)
for(var/datum/disease/D in active_diseases)
D.process()
diseases_ready = 1
src.set_debug_state("Old Disease Processing")
for(var/datum/disease/D in active_diseases)
D.process()
diseases_ready = 1
spawn(0)
for(var/obj/machinery/machine in machines)
if(machine)
machine.process()
if(machine && machine.use_power)
machine.auto_use_power()
src.set_debug_state("Machinery Processing")
for(var/obj/machinery/machine in machines)
if(machine)
machine.process()
if(machine && machine.use_power)
machine.auto_use_power()
machines_ready = 1
machines_ready = 1
sleep(-1)
sleep(1)
spawn(0)
for(var/obj/object in processing_objects)
object.process()
objects_ready = 1
src.set_debug_state("Object Processing")
for(var/obj/object in processing_objects)
object.process()
objects_ready = 1
spawn(0)
for(var/datum/pipe_network/network in pipe_networks)
network.process()
networks_ready = 1
src.set_debug_state("Pipe Network Processing")
for(var/datum/pipe_network/network in pipe_networks)
network.process()
networks_ready = 1
spawn(0)
for(var/datum/powernet/P in powernets)
P.reset()
powernets_ready = 1
src.set_debug_state("Powernet Processing")
for(var/datum/powernet/P in powernets)
P.reset()
powernets_ready = 1
sleep(-1)
spawn(0)
ticker.process()
ticker_ready = 1
src.set_debug_state("Mode Processing")
ticker.process()
ticker_ready = 1
src.set_debug_state("Idle")
sleep(world.timeofday+10-start_time)// Don't touch this. DMTG
while(!air_master_ready || !tension_master_ready || !sun_ready || !mobs_ready || !diseases_ready || !machines_ready || !objects_ready || !networks_ready || !powernets_ready || !ticker_ready)
sleep(1)
//while(!air_master_ready || !tension_master_ready || !sun_ready || !mobs_ready || !diseases_ready || !machines_ready || !objects_ready || !networks_ready || !powernets_ready || !ticker_ready)
// sleep(1)
spawn
process()