BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: Nytridr on February 07, 2007, 06:12:14 pm

Title: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 07, 2007, 06:12:14 pm
I have 1732 people on this raid bot I run.. when ever I do an !announce it will crash the bot.. the errors go by so fast I can not see the beginning of the errors.. but..I am able to see this..

Code: [Select]
Warning: socket_read(): unable to read from socket [0]: An established connectio
n was aborted by the software in your host machine.
 in C:\aobots\rsbot\aofbot\AOChat.php on line 222
Read error: An established connection was aborted by the software in your host m
achine.


Warning: socket_write(): unable to write to socket [0]: An established connectio
n was aborted by the software in your host machine.
 in C:\aobots\rsbot\aofbot\AOChat.php on line 310

I turned all logging on after I wrote this and basically I got close to 100 pages of the above before the bot restarted..

I am going to try the .3 aochat.php and see if that will work.. I thought I already did that with this raid bot but dont remember..

Nytridr
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 07, 2007, 06:18:39 pm
nope using the most recent aochat.php didnt work either.. now I got this one..

Code: [Select]
[07-Feb-2007 11:14:54] PHP Warning:  socket_write(): unable to write to socket [0]: An established connection was aborted by the software in your host machine.
 in C:\aobots\rsbot\aofbot\AOChat.php on line 340
[07-Feb-2007 11:14:54] PHP Warning:  socket_read(): unable to read from socket [0]: An established connection was aborted by the software in your host machine.
 in C:\aobots\rsbot\aofbot\AOChat.php on line 239

I am using the 1k files and have _ the normal ones .. I am also using the multiple org update module to keep multiple orgs updated.

any ideas?

Nytridr
Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 07, 2007, 10:04:57 pm
I think you are possibly running into the same issue that i did, but never got time to look into properly.

The bot i started having issues with after an AO patch had 3000 members or so. I'm guessing that Funcom changed something and that the bot is flooding itself off somehow.
Unfortunately i'm no longer even in a position where i can reproduce this :(

I'm pondering on a complete rewrite of the announce/invite modules at any rate since they are a royal mess.

Here's the modified one which was the last one i used. Note however that it assumes that you have an empty buddylist as it adds each member to check if they are online.
ymmw!
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 08, 2007, 12:17:06 am
okay this one starts to work.. I think it is erroring out adding the buddys.. can you do me a favor and just make it where it will send a msg to everyone single person no matter if they are online or not.. at least this would work for what we have going on with our raid bot.. since most of the time when an announce is used it is to get peoples attention that an event is going on.. and if they happen to log on during then they can still join..

I could care less if they are online at the time or not.. This would make it more simple for me to get this working I think..

just need to read from database and send message then wait a certain amount of time and send another message..and so on..

Nytridr
Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 08, 2007, 05:52:49 am
I can do that, however keep this in mind.

The chatsocket enforces a 2 second delay between tells. With 1732 members it will take the bot around one hour to send the messages.
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 08, 2007, 06:32:56 am
umm that is correct.. I wounder if there is a way to maybe fix this problem.. dont really care about the massinv just the announce working would be good.. in my limited knollege of things (which I hope is growing)  could it be posible that it is trying to add rem buddies to fast.. maybe have some kind of a timer or something to slow it down.. it does  partly work with checking for online.. I am able to get through about 20 people in the database before the bot crashs..

IDK just kind of thinking outloud here..

Nytridr

I just verified it.. it is sending out "Some" messages to people.. it is just crashing in the process of doing it..

actually I think it is crashing on sending the messages out.. I see only 5 messages sent out before it crashs if that helps at all..
Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 13, 2007, 10:27:34 pm
Ok. I was unable to reproduce this issue. However i did make one modification which might help.
Using the MassMsg file i gave you and making the following change to Bot.php.

Find the following in inc_buddy
Code: [Select]
$end = "";
if (!$mem)
{
$end = " (not member)";
$this -> aoc -> buddy_remove($user);
}
else if ($mem == 1)
{
$end = " (guest)";
}
else if ($mem == 2)
{
$end = " (member)";
}
else if ($mem == 3)
{
$end = " (admin)";
}

Change it to:
Code: [Select]
$end = "";
if (!$mem)
{
$end = " (not member)";
}
else if ($mem == 1)
{
$end = " (guest)";
}
else if ($mem == 2)
{
$end = " (member)";
}
else if ($mem == 3)
{
$end = " (admin)";
}
$this -> aoc -> buddy_remove($user);

This will ensure that the bot never has anyone on the buddylist which is exactly what we want for this specific purpose.

For 0.2 the code looks like this:
Code: [Select]
if (!$mem || ($mem == 2))
$this -> aoc -> buddy_remove($user);

if ($this -> is_member($name) != 1)
$this -> aoc -> buddy_remove($name);

Change to:
Code: [Select]
$this -> aoc -> buddy_remove($user);
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 14, 2007, 12:46:38 am
okay with these changes it actually made it all the way through the people to check to see who was online.. but crashed right after that..


Code: [Select]
[2007-02-13 23:40:34] [TELL] [INC] Nytridra: !announce ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:34] [TELL] [OUT] -> Nytridra: Mass message beeing sent. Please stand by...
[2007-02-13 23:40:38] [PGRP] [MSG] [Aofbot] Aofbot: Mass message beeing sent from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:38] [TELL] [OUT] -> Ender2006: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:38] [TELL] [OUT] -> Jlife: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:38] [TELL] [OUT] -> Soldzxxx: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:39] [TELL] [OUT] -> Vabot1: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:41] [TELL] [OUT] -> Drcherry: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:54] [TELL] [OUT] -> Mighterus: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test
[2007-02-13 23:40:54] [TELL] [OUT] -> Mrfli: Message from Nytridra: ... This is only a test.. if this was a real announcement you would be told what we were doing.. but this is only a test

Code: [Select]
[13-Feb-2007 17:41:14] PHP Warning:  socket_read(): unable to read from socket [0]: An existing connection was forcibly closed by the remote host.
 in C:\aobots\rsbot\aofbot\AOChat.php on line 239

as you can see some messages are being sent out.. SO.. whats next?  we are getting closer it seems..


I did something wierd.. really just testing some things out..

I used the .3 svn aochat.php file and put it on this .2 raid bot.. and guess what.. it got through all the user names.. but reached teh end and came up with an error..


when it got to the end of the user list it shot out..

Code: [Select]
Read error: EOF
Read error: EOF
Read error: EOF
Read error: EOF
Read error: EOF
Read error: EOF
Read error: EOF
Read error: EOF

now the EOF error is no where in the log files at all.....  so not sure where or what should be done.. what would be easier to fix the EOF or the old error?
Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 14, 2007, 05:39:34 pm
0.2 and 0.3 libraries are more or less identical except for ext message handling.

Please try using the MassMsg i posted, and also try commenting back in the debug line that states which buddy is being added. That way it should give you a better idea just when it crashes, and if it does it on the same person.

The errors are pretty much the same thing, both indicate that the bot is being booted from the chatserver.
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 15, 2007, 03:03:11 am
Okay still crashed with even with your modified version.. I am finding out some things.. I think it is windows related.. man I hate windows.. and if I could get *inx installed on the server I would.. but for some reason it will not and I have little time at home.. since I drive semi.. I do all of my work and game play out on the road.. But here is something I found


http://bugs.php.net/bug.php?id=21197&edit=3 (http://bugs.php.net/bug.php?id=21197&edit=3)

and another place to look
http://www.php.net/manual/en/function.socket-read.php (http://www.php.net/manual/en/function.socket-read.php)

I am thinking it is php releated.. is there any way to work around this bug.. *looks around carefully for someone pointing a gun at me*

Nytridr

aochat.php
following starts on line 218
Code: [Select]
    function read_data($len)
    {
      $data = "";
      $rlen = $len;
      while($rlen > 0)
      {
        if(($tmp = socket_read($this->socket, $rlen)) === false)
        {
          printf("Read error: %s\n", socket_strerror(socket_last_error($this->socket)));
          return "";
        }
        if($tmp == "")
        {
          echo("Read error: EOF\n");
          return "";
        }
        $data .= $tmp;
        $rlen -= strlen($tmp);
      }
      return $data;
    }


Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 16, 2007, 11:51:17 pm
I still cant reproduce this on Windows or Linux :\

Out of curiosity, what php version are you using?
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 17, 2007, 12:44:23 am
Code: [Select]
PHP 5.1.5 (cli) (built: Aug 15 2006 23:54:56)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 17, 2007, 04:07:01 pm
Just for the sake of it, could you try using the php 5.2 1 bundle to see if it makes any difference?
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 17, 2007, 04:30:53 pm
Code: [Select]
Warning: dl(): aokex: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=1
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
 in C:\aobots\rsbot\aofbot\main.php on line 85
Connected to MySQL

still loads up and connects

Code: [Select]
AOKex not availible, key generation might fail
Using bcmath for login key generation


then on an !announce I get the follow about a few hundred pages of the following

Code: [Select]
[14-Feb-2007 14:45:39] PHP Warning:  socket_read(): unable to read from socket [0]: An existing connection was forcibly closed by the remote host.
 in C:\aobots\rsbot\aofbot\AOChat.php on line 239
[14-Feb-2007 14:45:39] PHP Warning:  socket_read(): unable to read from socket [0]: An existing connection was forcibly closed by the remote host.

I honestly dont have no idea what it could be.. maybe a setting in my mysql.ini file or something IDK.. I am at a total loss..

Code: [Select]
PHP 5.2.1 (cli) (built: Feb  7 2007 23:11:26)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Title: Re: !announce on .2 raidbot crashs bot
Post by: Vhab on February 17, 2007, 07:02:09 pm
Throwing out some ideas
Correct me if I'm wrong since I'm assuming alot here without knowing how the thing really works, but here it goes:
The aunnounce module adds people to the friendslist to get their status, to do so it uses user id's directly from the database. one of these user id's is incorrect (probebly of a deleted character), when the bot tries to add it, fc's chat server gets angry and disconnects you.
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 17, 2007, 09:07:25 pm
I have an idea.. well first let me say this.. I was able to get through 2 full announcements today and the 3rd one crashed the bot with the above errors.. I have even when to mysql and put in there dll files.. to see if it was something incompatible..dont knwo if that was just a fluck about me getting through it or not but since then I have yet been unable to get through a full announce.

okay.. here is what i also did I put
extension=php_mysql.dll
extension=php_mysqli.dll

in my INI which seems to have speed everything up.. dont think php was looking for the sqli for the newer version of mysql.. anyway.. the problem still remains..

Okay I have did a little changing.. I thought I would just get the member list down to below 1k members.. I did that by removing any member below 100.  so now I am down to 711 members.. I put back in the standard massmsg.php , is.php, roster_raid.php.. and I am able to send out msg message to only 4 people and also mass invites also..

I am just kind of tyring to figure out what the issue is.. maybe this is part of the same issue.. these members where added through the orgraidroster module.. and it seems all members are properly filled in.. so how do I check to make sure those members are actaully on the bots friends list?

Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 17, 2007, 09:10:56 pm
Throwing out some ideas
Correct me if I'm wrong since I'm assuming alot here without knowing how the thing really works, but here it goes:
The aunnounce module adds people to the friendslist to get their status, to do so it uses user id's directly from the database. one of these user id's is incorrect (probebly of a deleted character), when the bot tries to add it, fc's chat server gets angry and disconnects you.

interesting concept.. but since I can dump the member table and have orgraidroster rebuild it..wouldnt it have the correct usernames and user ID's?  or maybe something is wrong with something with the xml transfer.. umm.. defently a posiblibity.. is there anyway to maybe write a script to see if what there is in the member table is valid against FC?  Maybe like a whois script that would just check the member table ?

or just thought of this.. also.. what about settings in my mysql.ini file OR even the tables being setup wrong?

would be nice to have a blank database to compair to just to make sure..
Title: Re: !announce on .2 raidbot crashs bot
Post by: Khalem on February 18, 2007, 10:17:07 pm
Blank database can be obtained by setting up a blank database and launching a BeBot using it once.

MySQLi has 0 effect on BeBot as BeBot doesn't make use of MySQLi since it's not bundled with PHP4 which we still support, and it hasn't been a priority adding compatibility for both.

What i can offer you at this point is modifying the module with a lot of debug calls to try and see if theres a pattern.

@Vhab, if memory serves we add by nickname, not by ID, and we call AOChat's functions directly.
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 19, 2007, 01:48:49 am
yes if you could that would be awesome.. maybe have it write it to a differnt log file if you could.. (not a biggy thought)  but yes.. some major debugging additions in the code would be helpful..

just maybe we can track this down..
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 22, 2007, 04:08:26 pm
This seems to be very random.. it seems like the sending the messages seems to be fine.. it is crashing somewhere in the adding and removing buddy part..

can you modify that part for me where it will actually put it in the log file for me.. I have tried to use the this -> bot -> log   part but it seems like it only puts it to screen.. I actually have to be watching the screen to see if there are any errors.  but when this happens there is nothing put out..it just stops for about 30 seconds and then spits out the errors..   

if someone could add some logging to every line to the log file if you could.. maybe this would help out..

I am going to do some actaul testing on the machine this weekend when I get home.. to make sure there isnt any problems with the RAM or anything.. I understand this is a wierd problem, but the problem I am having is even on my laptop I will still get this error.. and the only thing that the server pc and my laptop have in common is mysql, php, win xp pro... other then that there isnt any simullarities..

Nytridr
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on February 25, 2007, 10:57:26 pm
okay I was able to get it work for a few hours today.. after droping my member and whois tables.. whois never did get recreated but my members table did.. but I didnt have the ai stuff in it anymore.. I changed the php file to readd the ai stuff and it stoped working on me.. so I changed it back.. and now it still isnt working again.. I am woundering if it something to do with the members table somewhere..

any ideas?
Title: Re: !announce on .2 raidbot crashs bot
Post by: jjones666 on February 25, 2007, 11:15:21 pm
What roster are you using?  If you had AI info and don't now, strikes me something isn't working as intended.

Our raidbot runs 100% using info from the whois-cache, so i wrote this section to update the member table from there, and also re-add any missing buddies as a failsafe:

Code: [Select]
if (preg_match("/^" . $this -> bot -> commpre . "updateroster YES$/i", $msg, $info))
{
$result = $this -> bot -> db -> select("SELECT nickname, lastseen FROM members");
$inside = "<font color=CCInfoHeadline>:::: Roster update ::::</font>\n\n";
if (!empty($result))
foreach ($result as $val)
{
$nickname = $val[0];
$lastseen = $val[1];
$nickname = ucfirst(strtolower($nickname));

$num++;
$inside .= $num.". Updated <font color=#ffff00>".ucfirst($nickname)."</font>...\n";
$who = $this -> bot -> whois -> lookup($nickname);
$stamp = time();

$members["id"] = $this -> bot -> aoc -> get_uid($nickname);
$members["lastseen"] = $lastseen;
$members["nickname"] = $nickname;
$members["firstname"] = $who["firstname"];
$members["lastname"] = $who["lastname"];
$members["rank"] = $who["rank_id"];
$members["rank_name"] = $who["rank"];
$members["level"] = $who["level"];
$members["profession"] = $who["profession"];
$members["gender"] = $who["gender"];
$members["guild"] = $who["org"];
$members["breed"] = $who["breed"];
$members["at"] = $who["at"];
$members["at_name"] = $who["at_name"];

if (!$this -> bot -> aoc -> buddy_exists($nickname))
$this -> bot -> aoc -> buddy_add($members["id"]);

$this -> bot -> db -> query("DELETE FROM members WHERE id = " .$members["id"]);
$this -> bot -> db -> query("INSERT INTO members (id, lastseen, nickname, firstname, lastname, rank, rank_name, level, profession, gender, breed, ailevel, guild, aititle, updated)
VALUES ('" . $members["id"] . "', '" . $members["lastseen"] . "',
'" . $members["nickname"] . "', '" . $members["firstname"] . "',
'" . $members["lastname"] . "', '" . $members["rank"] . "',
'" . $members["rank_name"] . "', '" . $members["level"] . "',
'" . $members["profession"] . "', '" . $members["gender"] . "',
'" . $members["breed"] . "', '" . $members["at"] . "',
'" . $members["guild"] . "', '" . $members["at_name"] . "',
" . $stamp . ")");
}
$this -> bot -> send_tell($name, "Updating roster... ".$this -> bot -> make_blob("result", $inside));
}

Don't expect that to drop straight into the roster, but you may be able to make some use of the code.

-jj-
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on March 01, 2007, 12:25:17 am
okay I gave up on trying to get a massmsg on our raid bot to work.. I did how ever decide to go another route.. since teh org bots also have !announce I decided to go that route.. which would in turn speed the announces up also.. but now I am having a problem.. and not sure where to look..

Code: [Select]
function send_massmsg($from, $msg, $invite)
{
$all = $this -> bot -> db -> select("SELECT orgbotnames FROM orgbots ORDER BY orgbotnames ASC");
$this -> bot -> send_tell($from, "Mass message initiated to ".count($all)." Org Bots...");
$list = "<font color=CCInfoHeadline>::::: Mass Notification :::::</font><font color=CCInfoText>\n\n";

if (!empty($all))
{
foreach ($all as $member)
{

$this -> bot -> send_tell($member[0], "!announce from $from: <font color=#ffff00>$msg</font>/n"
.  $this -> bot -> make_blob("click to join bot", "/tell aofbot !join"), 1);
//$this -> bot -> log("sending $member the message");
$list .= "<font color=#ffff00>" . $member[0] . "</font> was sent \n";
}
return "Mass Notification :: " . $this -> bot -> make_blob("click to view", $list);
}
return "No bots found!";
}

Code: [Select]
To [Aoftest]: !announce testies
[Aoftest]: Mass message initiated to 2 Org Bots...
[Aoftest]: Mass Notification :: click to view

Code: [Select]
[2007-02-28 23:21:50]   [TELL]  [INC]   Aoftest: !announce from Metanyt: testies
/n[link]click to join bot[/link]
[2007-02-28 23:21:50]   [TELL]  [OUT]   -> Aoftest: /tell rsbot1 !help

both bots are coming out like that..

Code: [Select]
To [Rsbot1]: !security whois Aoftest
[Rsbot1]: Aoftest's highest access level is SUPERADMIN. Aoftest is a member of the following security groups: superadmin, admin, leader

okay.. SO.. what to do.. I can log onto Aoftest and manually do the !announce and it works.. so I am woundering if it has something to do between the 2 bots..

Nytridr
Title: Re: !announce on .2 raidbot crashs bot
Post by: Nytridr on March 01, 2007, 06:46:36 am
okay I found to problem with this little escapade of mine..(sp)   

could someone fix this for I can still have colors and still be able to send out properly formated tells please...

bot.php   (I know I know.. dont say it.., but I did find it)

Code: [Select]
/*
send a tell. Set $low to 1 on tells that are likely to cause spam.
*/
function send_tell($to, $msg, $low=0, $color=true)
{
$send = true;
if (preg_match("/<a href=\"(.+)\">/isU", $msg, $info))
if (strlen($info[1]) > $this -> maxsize)
{
$this -> cut_size($msg, "tell", $to, $low);
$send = false;
}

if ($send)
{
$msg = str_replace("<botname>", $this -> botname, $msg);
$msg = str_replace("<pre>", str_replace("\\", "", $this -> commpre), $msg);

if ($color)
//$msg = "<font color=" . $this -> tell_color . ">" . $msg . "</font>"; //this is for color in tells what I had to remove to get tells to work correctly when sent to other bots.

if ($this -> que -> check_que())
{
$this -> log("TELL", "OUT", "-> " . $this -> aoc -> get_uname($to) . ": " . $msg);
$msg = utf8_encode($msg);
$this -> aoc -> send_tell($to, $msg);
}
else
$this -> que -> into_que($to, $msg, "tell", $low);
}
}


I remember having this problem when trying to use gcr with the .3 releases.. not sure if anything is the same or what not.. I will have to look this weekend when I get home..(just something to look at)

the folloing code is what the problem was and things started working after I commented this line out..
spliting the load of the !annonce's works awesome and everyone got the announces in a fraction of the time..

Code: [Select]
$msg = "<font color=" . $this -> tell_color . ">" . $msg . "</font>";
Now if there is a way to auto get the command to be used (!, +, ect)  before sending out a tell to that bot..

any help is appreciated.

Nytridr
SimplePortal 2.3.7 © 2008-2024, SimplePortal