Increase error logging to diagnose server conking (#15662)

* Increase error logging to diagnose server conking

* more logging and db retry

* whoops

* rename error() to log_error() to better reflect what it does
Move a bunch of world.log messages to log_error

* Fix compile error

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
This commit is contained in:
Wildkins
2023-03-13 21:51:39 +00:00
committed by GitHub
co-authored by Werner
parent 62e25f5890
commit c369124fe9
42 changed files with 94 additions and 91 deletions
+3 -3
View File
@@ -7,7 +7,7 @@
return
if (!establish_db_connection(dbcon))
error("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
log_error("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
log_misc("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
return
@@ -49,7 +49,7 @@
return
else
error("No ban retreived while attempting to handle ban mirroring. Passed ban_id: [ban_id], ckey: [ckey].")
log_error("No ban retreived while attempting to handle ban mirroring. Passed ban_id: [ban_id], ckey: [ckey].")
log_misc("No ban retreived while attempting to handle ban mirroring. Passed ban_id: [ban_id], ckey: [ckey].")
return
@@ -58,7 +58,7 @@
return null
if (!establish_db_connection(dbcon))
error("Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
log_error("Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
log_misc("Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
return null
+1 -1
View File
@@ -52,7 +52,7 @@ world/IsBanned(key, address, computer_id, type, real_bans_only = FALSE)
if(!establish_db_connection(dbcon))
error("Ban database connection failure. Key [ckey] not checked")
log_error("Ban database connection failure. Key [ckey] not checked")
log_misc("Ban database connection failure. Key [ckey] not checked")
return ..()
+3 -3
View File
@@ -100,7 +100,7 @@ var/list/forum_groupids_to_ranks = list()
var/datum/admin_rank/rank_object = admin_ranks[rank]
if (!rank_object)
error("Unrecognized rank in admins.txt: \"[rank]\"")
log_error("Unrecognized rank in admins.txt: \"[rank]\"")
continue
//create the admin datum and store it for later use
@@ -114,7 +114,7 @@ var/list/forum_groupids_to_ranks = list()
else
//The current admin system uses SQL
if(!establish_db_connection(dbcon))
error("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
log_error("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
log_misc("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
@@ -134,7 +134,7 @@ var/list/forum_groupids_to_ranks = list()
D.associate(directory[ckey])
if(!admin_datums)
error("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_error("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_misc("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
config.admin_legacy_system = 1
load_admins()
+1 -1
View File
@@ -180,7 +180,7 @@ var/list/jobban_keylist = list() // Global jobban list.
/proc/jobban_loaddatabase()
// No database. Weee.
if (!establish_db_connection(dbcon))
error("Database connection failed. Reverting to the legacy ban system.")
log_error("Database connection failed. Reverting to the legacy ban system.")
log_misc("Database connection failed. Reverting to the legacy ban system.")
config.ban_legacy_system = 1
jobban_loadbanfile()
+1 -1
View File
@@ -20,7 +20,7 @@ var/list/admin_datums = list()
/datum/admins/New(initial_rank = "Temporary Admin", initial_rights = 0, ckey)
if(!ckey)
error("Admin datum created without a ckey argument. Datum has been deleted")
log_error("Admin datum created without a ckey argument. Datum has been deleted")
qdel(src)
return
+4 -4
View File
@@ -36,7 +36,7 @@
return
if (!establish_db_connection(dbcon))
error("SQL connection failed while attempting to delete a note!")
log_error("SQL connection failed while attempting to delete a note!")
return
var/count = 0 //failsafe from unban procs
@@ -52,12 +52,12 @@
if (count == 0)
to_chat(usr, "<span class='warning'>Database update failed due to a note id not being present in the database.</span>")
error("Database update failed due to a note id not being present in the database.")
log_error("Database update failed due to a note id not being present in the database.")
return
if (count > 1)
to_chat(usr, "<span class='warning'>Database update failed due to multiple notes having the same ID. Contact the database admin.</span>")
error("Database update failed due to multiple notes having the same ID. Contact the database admin.")
log_error("Database update failed due to multiple notes having the same ID. Contact the database admin.")
return
switch (note_edit)
@@ -92,7 +92,7 @@
admin_ckey = ckey(admin_ckey)
if (!establish_db_connection(dbcon))
error("SQL connection failed while attempting to view a player's notes!")
log_error("SQL connection failed while attempting to view a player's notes!")
return
var/dat = "<div align='center'><h3>Notes Look-up Panel</h3><br>"
+5 -5
View File
@@ -223,11 +223,11 @@
/client/proc/notifications_acknowledge(var/id)
if(!id)
error("Error: Argument ID for notificaton acknowledgement not supplied.")
log_error("Error: Argument ID for notificaton acknowledgement not supplied.")
return
if (!establish_db_connection(dbcon))
error("Error: Unable to establish db connection during notification acknowledgement.")
log_error("Error: Unable to establish db connection during notification acknowledgement.")
return
var/DBQuery/query = dbcon.NewQuery({"UPDATE ss13_player_notifications
@@ -420,7 +420,7 @@
return
if (!establish_db_connection(dbcon))
error("Error: Unable to establish db connection while adding a notification.")
log_error("Error: Unable to establish db connection while adding a notification.")
return
var/ckey = ckey(input(usr, "What ckey?", "Enter a ckey"))
@@ -483,12 +483,12 @@
if (count == 0)
to_chat(usr, "<span class='warning'>Database update failed due to a warning id not being present in the database.</span>")
error("Database update failed due to a warning id not being present in the database.")
log_error("Database update failed due to a warning id not being present in the database.")
return
if (count > 1)
to_chat(usr, "<span class='warning'>Database update failed due to multiple warnings having the same ID. Contact the database admin.</span>")
error("Database update failed due to multiple warnings having the same ID. Contact the database admin.")
log_error("Database update failed due to multiple warnings having the same ID. Contact the database admin.")
return
switch (warning_edit)