Deleted characters not being caught
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
BeBot |
Confirmed
|
Low
|
Unassigned |
Bug Description
Due to a recent player deleting his character to make sure he didn't return to AO i caught this bug.
Basically the character never leaves org, just deletes character and does NOT roll a nameholder character.
Now this would normally be no problem, and the bot would catch it since his userid no longer exists right? Wrong?
In AOChatWrapper the following is found:
/*
This is a wrapper function for aoc->get_uid() that checks the whois cache if aoc->get_uid() failes
*/
function get_uid($user)
{
if(empty($user))
{
$this-
// TODO: adapt all calls to get_uid() to check for instanceof BotError?
// return(
return false;
}
//Attempt to get uid from FC (This fails randomly)
$uid = $this -> bot -> aoc -> get_uid($user);
//When it fails attempt to get it from the cache.
if($uid === false)
{
$db_uid = $this -> bot -> db -> select("SELECT ID FROM #___whois WHERE nickname = '" . $user . "' LIMIT 1", MYSQL_ASSOC);
if (!empty($db_uid))
{
$uid = $db_uid[0]['ID'];
}
else
{
$this -> error -> set("I was unable to get the user id for user: '$user'");
// TODO: adapt all calls to get_uid() to check for instanceof BotError?
// return(
return false;
}
}
return $uid;
}
Basically the bot states that if a userid lookup fails, we blindly lookup from whois table, and if we have an entry for the character (which will probably be true in 99.9% of the cases where this is an issue), blindly assume the character exists.
This leads to things like roster management not being able to pick up that the character no longer exists (not that much of an issue, just annoying log spam)
But a more visible issue is that !whois will always return the cached information.
I'm not sure what the best approach to this issue would be offhand. Should we expire information from whois table? Should we remove the check in AOChatWrapper? Should we improve the logic in AOChatWrapper?
Personally i dont know how unreliable funcom uid lookups are, but the way it stands now, anything! anywhere! in the bot doing get_uid to check if a character exists is pretty much broken as far as i can tell if there is an entry in the whois table.
Changed in bebot: | |
importance: | Undecided → Low |
status: | New → Confirmed |
I believe this was added due to some timeout problem of the chatservers when doing mass uid-checks. Which as a follow-up broke some stuff.
But yes, it should be changed.
Simply re-checking the UID in the whois table every 24h or something like that might mitigate the problem.
But I think the root of the problem actually is in the AOChat class, as I remember someone mentioning that the lookup cache for id/name pairs never times out either. So basically if a bot is running for a long time like weeks at once the cache never gets whiped. This results in always returning out-dated information.