collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Buddy Queue on Startup  (Read 5968 times)

0 Members and 1 Guest are viewing this topic.

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Buddy Queue on Startup
« on: November 12, 2010, 10:55:49 am »
I get a huge number (probably 100+) of these types of entries when I restart or launch the bot

Sancbot [BUDDY QUEUE]   [BUDDY-ADD]     17205641
Sancbot [BUDDY QUEUE]   [BUDDY-ADD]     17242703
Sancbot [BUDDY QUEUE]   [BUDDY-ADD]     17227432
Sancbot [BUDDY QUEUE]   [BUDDY-ADD]     17208441

Along with names of characters I recognise and the infamous "-1" about 30 times.

Where is this list of entities to add to the buddy queue kept? I've gone through every file in the /bebot directory searching for the names or numbers and not found a single reference. I've also tried to step through the CHAT code to figure it out from there but it's beyond my PHP skills.

What I want to do is clear this queue out of entries so it's not wasting it's time trying to add characters that simply don't exist any more.

Anyone have any ideas?

G

Offline Yite

  • BeBot Apprentice
  • ***
  • Posts: 152
  • Karma: +0/-0
    • Niflheim - Crom
Re: Buddy Queue on Startup
« Reply #1 on: November 12, 2010, 11:24:51 am »
Could this be the friends list of the bot character?
-Yite [Crom]

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #2 on: November 12, 2010, 01:05:35 pm »
Well it might be but as far as I know, AoC doesn't cache an arbitrary list of buddies ready to add offline which it then tries to reapply when you're online does it? It would surely just fail the names/ID's that don't exist any more and just say the person doesn't exist as it does when you do it manually.

G


Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Buddy Queue on Startup
« Reply #3 on: November 12, 2010, 08:49:38 pm »
I did not write this part of the code, so not really sure about this one. And since I don't have a working AOC bot within an active guild It is very hard for me to debug this.

However if you open up core/Buddy_Queue.php and find the following function on line 74
Code: [Select]
function do_add($uid)
{
if (!empty($uid) && $uid != 0 && $uid != -1)
{
if (!($this -> bot -> core("chat") -> buddy_exists($uid)))
{
$this -> bot -> aoc -> buddy_add($uid);
$this -> bot -> log("BUDDY QUEUE", "BUDDY-ADD", $this -> bot -> core("chat") -> get_uname($uid));
}
}
else
{
$this -> bot -> log("BUDDY QUEUE", "BUDDY-ERROR", "Tried to add " . $this -> bot -> core("chat") -> get_uname($uid) . " as a buddy when they already are one.");
}
}

Change this to:

Code: [Select]
function do_add($uid)
{
if (!empty($uid) && $uid != 0 && $uid != -1)
{
if (!($this -> bot -> core("chat") -> buddy_exists($uid)))
{
$this->bot->log("DEBUG", "BuddyQueue", $this->bot->debug_bt());
$this -> bot -> aoc -> buddy_add($uid);
$this -> bot -> log("BUDDY QUEUE", "BUDDY-ADD", $this -> bot -> core("chat") -> get_uname($uid));
}
}
else
{
$this -> bot -> log("BUDDY QUEUE", "BUDDY-ERROR", "Tried to add " . $this -> bot -> core("chat") -> get_uname($uid) . " as a buddy when they already are one.");
}
}

In Sources/Bot.php add the following function at the bottom of the file (before the last closing } and ?>)
Code: [Select]
function debug_bt()
{
$trace = debug_backtrace();
$r = '';

foreach($trace as $i=>$call)
{
if (is_object($call['object']))
{
$call['object'] = 'CONVERTED OBJECT OF CLASS '.get_class($call['object']);
}

if (is_array($call['args']))
{
foreach ($call['args'] AS &$arg)
{
if (is_object($arg))
{
$arg = 'CONVERTED OBJECT OF CLASS '.get_class($arg);
}
}
}

$r .= "#" . $i . " " . (isset($call['file']) ?  $call['file'] : '') . '(' . (isset($call['line']) ? $call['line'] : '' ) . ') ';
$r .= (!empty($call['object'])?$call['object'].$call['type']:'');
$r .= $call['function'].'('.implode(', ',$call['args']).')';
$r .= "\n";
}
 
return $r;
}

This is likely to create a fair amount of log spam, but it will give a backtrace showing where the actual add is originating from (hopefully) or at least get us one step closer.

Then please post a backtrace of an add you know is a broken UID either here or in a PM to me.
BeBot Founder and Fixer Kingpin

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #4 on: November 13, 2010, 09:55:55 pm »
Made the changes, restarted the bot, didn't get anything at all. Is it being dumped into another file or something?

G

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #5 on: November 15, 2010, 11:37:51 am »
Ok for some reason, on one of the restarts I did this morning it seems to have worked (but only on 1)

I've included 2 of the "adds" here

Code: [Select]
Bot [BUDDY QUEUE]   [BUDDY-ADD]     17168742
Bot [DEBUG] [BuddyQueue]    #0 I:\Bebot\core\Buddy_Queue.php(80) CONVERTED OBJECT OF CLASS Bot->debug_bt()
#1 I:\Bebot\core\Buddy_Queue.php(117) CONVERTED OBJECT OF CLASS Buddy_Queue_Core->do_add(117502154)
#2 I:\Bebot\main\14_Queue.php(94) CONVERTED OBJECT OF CLASS Buddy_Queue_Core->queue(buddy, Array)
#3 I:\Bebot\Sources\Bot.php(1518) CONVERTED OBJECT OF CLASS Queue_Core->cron(1)
#4 I:\Bebot\Sources\Bot.php(1550) CONVERTED OBJECT OF CLASS Bot->cronjob(1289816785, 1)
#5 I:\Bebot\Main.php(483) CONVERTED OBJECT OF CLASS Bot->cron()
#6 () callback(20, Array, )
#7 I:\Bebot\Sources\AOChat.php(471) call_user_func(callback, 20, Array, )
#8 I:\Bebot\Sources\AOChat.php(1171) CONVERTED OBJECT OF CLASS AOChat->get_packet()
#9 I:\Bebot\Sources\AOChat.php(1194) CONVERTED OBJECT OF CLASS AOChat->lookup_user(Exiator)
#10 I:\Bebot\main\15_AOChatWrapper.php(71) CONVERTED OBJECT OF CLASS AOChat->get_uid(Exiator)
#11 I:\Bebot\core\aoc\Whois.php(324) CONVERTED OBJECT OF CLASS AOChatWrapper_Core->get_uid(Exiator)
#12 I:\Bebot\main\10_Roster.php(467) CONVERTED OBJECT OF CLASS Whois_Core->lookup(Exiator)
#13 I:\Bebot\main\10_Roster.php(217) CONVERTED OBJECT OF CLASS Roster_Core->update_guild()
#14 I:\Bebot\Sources\Bot.php(1518) CONVERTED OBJECT OF CLASS Roster_Core->cron(86400)
#15 I:\Bebot\Sources\Bot.php(1550) CONVERTED OBJECT OF CLASS Bot->cronjob(1289816770, 86400)
#16 I:\Bebot\Main.php(483) CONVERTED OBJECT OF CLASS Bot->cron()
#17 () callback(60, Array, )
#18 I:\Bebot\Sources\AOChat.php(471) call_user_func(callback, 60, Array, )
#19 I:\Bebot\Sources\AOChat.php(1171) CONVERTED OBJECT OF CLASS AOChat->get_packet()
#20 I:\Bebot\Sources\AOChat.php(1194) CONVERTED OBJECT OF CLASS AOChat->lookup_user(Sancbot)
#21 I:\Bebot\main\15_AOChatWrapper.php(71) CONVERTED OBJECT OF CLASS AOChat->get_uid(Sancbot)
#22 I:\Bebot\core\aoc\Whois.php(246) CONVERTED OBJECT OF CLASS AOChatWrapper_Core->get_uid(Sancbot)
#23 I:\Bebot\main\03_Security.php(1748) CONVERTED OBJECT OF CLASS Whois_Core->lookup(Sancbot)
#24 I:\Bebot\main\03_Security.php(2000) CONVERTED OBJECT OF CLASS Security_Core->set_government()
#25 I:\Bebot\main\03_Security.php(1958) CONVERTED OBJECT OF CLASS Security_Core->cache_org_ranks()
#26 I:\Bebot\main\03_Security.php(211) CONVERTED OBJECT OF CLASS Security_Core->cache_security()
#27 I:\Bebot\Sources\Bot.php(1518) CONVERTED OBJECT OF CLASS Security_Core->cron(43200)
#28 I:\Bebot\Sources\Bot.php(1550) CONVERTED OBJECT OF CLASS Bot->cronjob(1289816770, 43200)
#29 I:\Bebot\Main.php(483) CONVERTED OBJECT OF CLASS Bot->cron()
#30 () callback(60, Array, )
#31 I:\Bebot\Sources\AOChat.php(471) call_user_func(callback, 60, Array, )
#32 I:\Bebot\Sources\AOChat.php(302) CONVERTED OBJECT OF CLASS AOChat->get_packet()
#33 I:\Bebot\Main.php(469) CONVERTED OBJECT OF CLASS AOChat->wait_for_packet()

and

Code: [Select]
Bot [BUDDY QUEUE]   [BUDDY-ADD]     -1
Bot [DEBUG] [BuddyQueue]    #0 I:\Bebot\core\Buddy_Queue.php(80) CONVERTED OBJECT OF CLASS Bot->debug_bt()
#1 I:\Bebot\core\Buddy_Queue.php(117) CONVERTED OBJECT OF CLASS Buddy_Queue_Core->do_add(17203975)
#2 I:\Bebot\main\14_Queue.php(94) CONVERTED OBJECT OF CLASS Buddy_Queue_Core->queue(buddy, Array)
#3 I:\Bebot\Sources\Bot.php(1518) CONVERTED OBJECT OF CLASS Queue_Core->cron(1)
#4 I:\Bebot\Sources\Bot.php(1550) CONVERTED OBJECT OF CLASS Bot->cronjob(1289816798, 1)
#5 I:\Bebot\Main.php(472) CONVERTED OBJECT OF CLASS Bot->cron()

They all seem to fall into one of these two types of response.

Any ideas?

G

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Buddy Queue on Startup
« Reply #6 on: November 15, 2010, 04:54:29 pm »
Ok.

I am assuming here that Exiator is an deleted character?

If so I think I am forming an idea on how to properly deal with this issue.
BeBot Founder and Fixer Kingpin

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #7 on: November 15, 2010, 05:00:16 pm »
Hi,

Yes he is - or rather a character who's now left the guild. I've not looked closely enough to figure out whether they all are but certainly it's the vast majority of them.

Buff

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #8 on: November 22, 2010, 11:21:00 am »
Did you get any joy with this?

G

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Buddy Queue on Startup
« Reply #9 on: November 27, 2010, 10:58:53 pm »
I won't have time to formulate this into code until after my midterms, but I think I can eliminate some of these at least by altering how roster updates are done, as well as improving error handling as we really should not allow buddy adds for -1 to happen even if it should have been caught earlier.
BeBot Founder and Fixer Kingpin

Offline Runemy

  • BeBot Apprentice
  • ***
  • Posts: 97
  • Karma: +0/-0
    • Exalted [Age of Conan guild - Aquilonia EU]
Re: Buddy Queue on Startup
« Reply #10 on: December 02, 2010, 05:44:00 pm »
Just adding a screeny of the startup at our end. We host two bots, and it's the same issue with both of them, the -1's that is. I've added the code where it removes the instances of -1's in the three tables that might get "infected", but yeah, buddy queue.. :)

Wood of Exalted
Age of Conan
Aquilonia - EU

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #11 on: December 04, 2010, 01:19:00 pm »
Thats Khalem. No hassle at all just thankful you're looking at it so whenever you can I can wait :)

@Runemy - At least it's not just me!

G

Offline Runemy

  • BeBot Apprentice
  • ***
  • Posts: 97
  • Karma: +0/-0
    • Exalted [Age of Conan guild - Aquilonia EU]
Re: Buddy Queue on Startup
« Reply #12 on: December 04, 2010, 03:53:33 pm »
Was thinking though, can this somehow be relevant to the fact that I guildkick all chars that has been inactive for more than 30 days?
Wood of Exalted
Age of Conan
Aquilonia - EU

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #13 on: December 04, 2010, 06:04:24 pm »
Was thinking though, can this somehow be relevant to the fact that I guildkick all chars that has been inactive for more than 30 days?

The -1 I don't think has anything to do with it. I do also guild kick anyone inactive for 30 days or more but thats doesn't seem to be the rootof it. People get -1 kicked or not kicked. It's also totally random and can even repair itself while people are actually online as -1.

Anyway I'm sure Khalem's on it when he gets time. All good :)

G

Offline GBH

  • BeBot Hero
  • ******
  • Posts: 69
  • Karma: +0/-0
Re: Buddy Queue on Startup
« Reply #14 on: January 10, 2011, 02:07:41 pm »
Hiya Khalem. No hassle just bringing this to the top of the pile.

Any movement with this?

Cheers

GBH

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 252
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal