L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 01, 2008, 02:18:48 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: Strangest problems with bot
Pages: [1]   Go Down
« previous next »
Print
Author Topic: Strangest problems with bot  (Read 796 times)
0 Members and 1 Guest are viewing this topic.
pusikas
Experienced
****
Offline Offline

Posts: 161


Strangest problems with bot
« on: April 04, 2007, 10:27:32 AM »

Lately, I am getting some very strange behavior from the bot, and so far, I have been unable to pinpoint it. I posted in the !alts thread before, but that is probably the wrong place.
I am using a 2.11 bot with most of the modules that are confirmed to work from JJ's list.

The first thing is very annoying: Me (Luuv) gets my id in the members table set to 0 occasionally. This results in the bot crashing when I log on. If I delete the row and do a "!member del Luuv" and then a "!member Luuv", it works again - for a while.

The second thing is stranger, I noticed it with the new Alts-module that JJ posted, but the !is command gets confused as well. http://bebot.shadow-realm.org/index.php/topic,204.msg5504.html#msg5504 shows some of my pain. Smiley

Another example: I have someone on guestlist that is not in org. Now check out the following crap and tell me why this happens:
Code:
[2007-04-04 15:15:52]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:15:52]   [BUDDY] [LOG]   Ilikethongs logged [on] (guest)
[2007-04-04 15:15:52]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:30]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:30]   [BUDDY] [ERROR] Ilikethongs logged on despite of already being marked as logged on!!
[2007-04-04 15:16:34]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:34]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:35]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:35]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:37]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:37]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:38]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:38]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
After that, the person logs off, and I get the following without stating another !is:
Code:
[2007-04-04 15:23:58]   [BUDDY] [LOG]   Ilikethongs logged [off] (guest)
[2007-04-04 15:23:58]   [TELL]  [OUT]   -> Luuv: Ilikethongs is offline
So the first time I do !is, the bot notices a logon and tells me the guy is online. The second time, the bot complains that he is already logged on, but never tells me that he is online. Each time after that, ths !is command works ok. All the time, the !alts command shows him as offline.

I can't figure out when and why this started to happen. I can install a vanilla bot and see if it happens there as well. Any other ideas what I could try, or why this might happen? Looks to me like the problems come from the buddy functions in AOChat.php, but I never touched that file -  I use the one that came with the 2.11 bot.
« Last Edit: April 04, 2007, 10:33:05 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Strangest problems with bot
« Reply #1 on: April 06, 2007, 08:49:59 PM »

Quote from: pusikas on April 04, 2007, 10:27:32 AM
The first thing is very annoying: Me (Luuv) gets my id in the members table set to 0 occasionally. This results in the bot crashing when I log on. If I delete the row and do a "!member del Luuv" and then a "!member Luuv", it works again - for a while.

Could you get me the error that gets output to console/log when this happens as i'd like to fix the crash at the very least Smiley

I'm not quite sure where this actually occurs. But i think the best way to track it down would be to add a debug line to all instances in the bot where the id is potentially inserted into the database and output a warning to console/log with debug info.

Quote
The second thing is stranger, I noticed it with the new Alts-module that JJ posted, but the !is command gets confused as well. http://bebot.shadow-realm.org/index.php/topic,204.msg5504.html#msg5504 shows some of my pain. Smiley

Another example: I have someone on guestlist that is not in org. Now check out the following crap and tell me why this happens:
Code:
[2007-04-04 15:15:52]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:15:52]   [BUDDY] [LOG]   Ilikethongs logged [on] (guest)
[2007-04-04 15:15:52]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:30]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:30]   [BUDDY] [ERROR] Ilikethongs logged on despite of already being marked as logged on!!
[2007-04-04 15:16:34]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:34]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:35]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:35]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:37]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:37]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
[2007-04-04 15:16:38]   [TELL]  [INC]   Luuv: !is ilikethongs
[2007-04-04 15:16:38]   [TELL]  [OUT]   -> Luuv: Ilikethongs is online
After that, the person logs off, and I get the following without stating another !is:
Code:
[2007-04-04 15:23:58]   [BUDDY] [LOG]   Ilikethongs logged [off] (guest)
[2007-04-04 15:23:58]   [TELL]  [OUT]   -> Luuv: Ilikethongs is offline
So the first time I do !is, the bot notices a logon and tells me the guy is online. The second time, the bot complains that he is already logged on, but never tells me that he is online. Each time after that, ths !is command works ok. All the time, the !alts command shows him as offline.

I can't figure out when and why this started to happen. I can install a vanilla bot and see if it happens there as well. Any other ideas what I could try, or why this might happen? Looks to me like the problems come from the buddy functions in AOChat.php, but I never touched that file -  I use the one that came with the 2.11 bot.

Ohh boy. I knew this would come back to bite me in the arse somehow.
Basically this is whats happening:
- Person logs on, gets tagged as logged on by the online cache
- !is is called for this person, adds the person as a buddy to generate a logged on/off event. Cache catches said event, throws a warning to console and never passes the event on to anything in the bot.
- !is sits and waits for the event which never arrives, until the person logs off and generates an event that is different from the cached event.

Although im a bit puzzled towards why you get a response to subsequent !is commands for the same person O.o
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Strangest problems with bot
« Reply #2 on: April 07, 2007, 09:53:45 AM »

Quote from: Khalem on April 06, 2007, 08:49:59 PM
Could you get me the error that gets output to console/log when this happens as i'd like to fix the crash at the very least Smiley

I'm not quite sure where this actually occurs. But i think the best way to track it down would be to add a debug line to all instances in the bot where the id is potentially inserted into the database and output a warning to console/log with debug info.


The crash happens here:
Code:
[04-Apr-2007 17:00:51] PHP Fatal error:  Cannot use string offset as an array in /usr/local/vbot/modules/Logon_GUILD.php on line 108
The line 108 looks like this:
Code:
$res .= " (Lvl <font color=#ffffff>" . $result[0][3] . "</font> / <font color=#00ff60>" . $result[0][6] . " (" . $result[0][7] . ")</font> <font color=#ffffff>" . $result[0][4] . "</font> " . $result[0][5] . ") logged on.";
I think that line is slightly modified, not the original anymore. But if I am not mistaken, the problem is this line:
Code:
$id = $this -> bot -> aoc -> get_uid($name);
That gets the "real" ID of the user logging on, not the one that is in the database (due to the default value of zero, it is 0 in the database). The following SELECT on the members table doesn't fetch any rows. But maybe I misinterpret the code here. No idea. Smiley

It hasn't happened to my own toons anymore. I inserted some debug messages and am hoping for the error that causes the 0 to be inserted into the ID column to come back. Well, I wouldn't mind if I never get it again, either. Smiley
Some sanity check on the SELECT might help, so that the logon message is surpressed if the SELECT returns no rows, and a message like "$name logged on, but his entry in the members table is faulty" as output.

Edit: I changed the Logon_GUILD.php a bit, so that it no longer crashes the bot when a toon with ID = 0 i nthe database logs on. Dunno if I am the only one with this problem, but still, here it is. Smiley Contains my own take on the colors for logons, so it may not be for everyone...
« Last Edit: April 07, 2007, 10:22:03 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Blueeagle
Omnipotent
BeBot Developer
Expert
********
Offline Offline

Gender: Male
Posts: 313



Re: Strangest problems with bot
« Reply #3 on: April 07, 2007, 09:07:45 PM »

Try inserting a line above the one that is causing the error that reads
Code:
var_dump($result);

That should print out what $result contains. The error message indicates that it does not contain an array as is expected. (ie it might be NULL, FALSE or contain a string).

Hope that helps.
Logged

The only problem that can't be solved by adding another wrapper is having too many wrappers.
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Strangest problems with bot
« Reply #4 on: April 07, 2007, 09:50:44 PM »

Reason why the bot crashes is clear - just update any character id with 0 in the database and see what happens when that person logs on. Smiley

What I do not understand is why the ID gets updated with zero in the first place. It has happened to my own toon twice and to one other toon in the org so far. I have added some debug code in the Roster_GUILD module where I suspect it may happen (I booby-trapped the area around the REPLACE command), but this crap hasnt occured again so far, so no news on that one. I am sitting here an HOPING for the bot messing it up again. That's new. Smiley
« Last Edit: April 07, 2007, 09:56:12 PM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Strangest problems with bot
« Reply #5 on: April 08, 2007, 08:00:18 AM »

Crash fixed in SVN.
Improper error checking.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Strangest problems with bot
« Reply #6 on: April 08, 2007, 12:32:35 PM »

Small note on the !is problem.

The only real solution here is to rewrite !Is to take into account the cache as the cache is needed.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Strangest problems with bot
« Reply #7 on: April 09, 2007, 06:40:29 PM »

Sooo... nothing I can do, I guess. I do not even think I fully undersdtand what the problem is. ^^
Logged

Luuv  Bot-Keeper of Vengeance ^^*
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Strangest problems with bot
« Reply #8 on: April 10, 2007, 10:49:14 AM »

Not unless we can figure out where and why it's inserting a 0.

I'll see if i can find some time to look over this once again and maybe add some error checking to avoid null id's from being entered in the first place. But 0.2.x is a mess.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Strangest problems with bot
« Reply #9 on: April 10, 2007, 12:48:55 PM »

Today the bot did it again, but a bit differently, which is why my booby-traps didnt fire. It did not REPLACE with zero - it just deleted me entirely.
Code:
[2007-04-10 03:08:16]   [BUDDY] [ADD]   0
[2007-04-10 03:08:16]   [BUDDY] [ADD]   Younggunz
[2007-04-10 03:08:16]   [BUDDY] [ADD]   Miiii
[2007-04-10 03:08:16]   [BUDDY] [DEL]   Luuv
[2007-04-10 03:08:16]   [ROSTER]        [UPDATE]        Luuv removed
[2007-04-10 03:08:16]   [ROSTER]        [UPDATE]        Roster update complete. Added 3 members, removed 1.

WTH? Not only did it remove me for no apparent reason, it also added a member named  "0". Way to go. I checked for PHP errors or warnings, and there were none in the logs around that time.

The whois-cache seems to work smoothly, I am currently thinking about just removing that roster update as it currently is and just copy over the relevant stuff form the whois-cache twice a day or so... is there any reason not to do it this way? Before I try that and find out the hard way, someone tell me please. Smiley
« Last Edit: April 10, 2007, 12:51:19 PM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Strangest problems with bot
« Reply #10 on: April 10, 2007, 01:59:31 PM »

I use the cache 100% for our raidbot, it works fine.

-jj-
Logged
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Strangest problems with bot
« Reply #11 on: April 11, 2007, 02:50:54 AM »

Yep, that works nicely so far, and is faster as well. Smiley
Logged

Luuv  Bot-Keeper of Vengeance ^^*
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Strangest problems with bot
« Reply #12 on: April 11, 2007, 07:27:07 AM »

In the end, you may possibly get the same error, unless you keep the whois cache up to date.  I'd not thought of doing this for the org, can you PM me with the code? :-)

-jj-
Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Strangest problems with bot
« Reply #13 on: April 14, 2007, 07:38:23 PM »

Curious. Could it be Funcom XML somehow screwing up? If my memory serves, nickname is taken directly from XML, which means in the XML version there should have been a member with the nickname 0. Bizarre.
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Strangest problems with bot
« Reply #14 on: April 14, 2007, 09:21:48 PM »

Hmmm... what might have happened (didn't check the time) is that the Roster Update and the whois-cache update ran at the same time. They won't interfere directly, but accessing those FC pages isn't exactly fast from where I live. Didn't see any timeouts in the php-errorlog, tho. Also, I am sitting behind a transparent proxy - maybe it messed those requests up. But I Dunno how I should test THAT. Good news is, that I haven't had any more problems since I am updating the members table from the whois cache. If they did interfere before, they can't do that anymore, and I have never spotted any wrong entries in the cache.

!is and JJ's !alts command still are a bit unreliable, and spam my console with strange messages, but nothing I can't bear.
Logged

Luuv  Bot-Keeper of Vengeance ^^*
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: Strangest problems with bot
« previous next »
 
Jump to:  

Recent
[request] Raid timers
by Alreadythere
[Today at 11:42:32 AM]

Shared DB online list
by Temar
[Today at 01:55:47 AM]

relay colors
by Temar
[Today at 01:54:56 AM]

BeBot v0.6.0 released
by Alreadythere
[November 30, 2008, 05:32:00 PM]

Change to Bid.php
by Temar
[November 30, 2008, 11:41:44 AM]

OnlineOrg
by Jiheld
[November 29, 2008, 12:44:27 PM]

Silly Newbie Question.
by Temar
[November 29, 2008, 12:00:02 PM]

massive_pvp_time_table 1
by gerborg
[November 29, 2008, 06:55:35 AM]

Bot not see Guild Chat
by Delvar
[November 28, 2008, 08:30:34 AM]

Starting Bot
by Allisande
[November 28, 2008, 07:08:21 AM]
Stats
Members
Total Members: 1243
Latest: Whackoeng
Stats
Total Posts: 11143
Total Topics: 1505
Online Today: 21
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 1
Guests: 22
Total: 23

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.46 seconds with 28 queries. (Pretty URLs adds 0.038s, 4q)
Loading...