AOChatProxy Problem

General discussion on Budabot.
westnile
Member
Posts: 4
Joined: Tue Sep 09, 2014 6:54 am
antispam: rimor

AOChatProxy Problem

Postby westnile » Tue Sep 09, 2014 7:58 am

So I was asked to run our orgs bot for the owner for a few days while they do some maintenance on their home.

It ran fine no issues what so ever first day through the next then out of no where the bot spammed a bunch of stuff and repeatedly disconneted from the server and some how laged me out so bad on my network it disconnected my client on my other machine.

I don't know wtf cause it but my server machine the bot sits on is a amd quad core 2.3ghz 8 gigs of ram and I am on a near t1 connection below is the txt that flooded the bot window when it disconnected and cause mass lag across my network some how.

C:\anarchy online addons\bot\aochatproxy1.1>java -jar aochatproxy.jar
2014-09-08 22:33:16,084 INFO [main] (Program.scala:43) - Ready to accept a mast
er bot on port 9993
2014-09-08 22:33:27,075 INFO [clientHandler] (ClientHandler.scala:114) - starti
ng proxy bot main
2014-09-08 22:33:27,080 INFO [clientHandler] (ClientHandler.scala:114) - starti
ng proxy bot slave1
2014-09-08 23:31:52,762 ERROR [chatPacketListener] (ChatPacketListener.java:45)
- Bot Character: 'name removed' packet id: '37'
java.lang.RuntimeException: java.lang.RuntimeException: Unknown param type in ex
tended message: 'l'
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:30)
at com.jkbff.ao.tyrlib.packets.server.SystemMessage.<init>(SystemMessage
.java:30)
at com.jkbff.ao.tyrlib.packets.BaseServerPacket.createInstance(BaseServe
rPacket.java:45)
at com.jkbff.ao.tyrlib.chat.ChatPacketListener.run(ChatPacketListener.ja
va:38)
Caused by: java.lang.RuntimeException: Unknown param type in extended message: '
l'
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.parseParams(ExtendedMessa
ge.java:73)
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:28)
... 3 more
2014-09-08 23:31:52,794 ERROR [chatPacketListener] (ChatPacketListener.java:45)
- Bot Character: 'name removed' packet id: '37'
java.lang.RuntimeException: java.lang.RuntimeException: Unknown param type in ex
tended message: 'l'
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:30)
at com.jkbff.ao.tyrlib.packets.server.SystemMessage.<init>(SystemMessage
.java:30)
at com.jkbff.ao.tyrlib.packets.BaseServerPacket.createInstance(BaseServe
rPacket.java:45)
at com.jkbff.ao.tyrlib.chat.ChatPacketListener.run(ChatPacketListener.ja
va:38)
Caused by: java.lang.RuntimeException: Unknown param type in extended message: '
l'
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.parseParams(ExtendedMessa
ge.java:73)
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:28)
... 3 more


the last time this happened I disconnected my primary clients on my gaming machine and the bot recovered pretty quickly and I was able to get back on and play again.

It almost seems like someone was trying to exploit the bot or java or something and it wigged out I could be wrong I am proficient in most network security protocol's been involved in that field of IT for 20 years now.

It just seemed very strange that it ran fine then did this several times now its fine again after 4 or 5 bouts with this which lasted 45 mins roughly.

that also involved me shutting down my router my firewall etc restarting server machine and still dealing with it happening after fresh restarts.

If anyone has any insight so we might be able to prevent this in the future please let me know.

Thanks,
West
Tyrence
The Team
Posts: 1883
Joined: Sat Jan 09, 2010 1:32 am

Re: Quick Question

Postby Tyrence » Tue Sep 09, 2014 10:29 am

The problem is that the chat proxy doesn't understand some of the data being sent to it. Compare these two methods:

Budabot: https://github.com/Budabot/Budabot/blob ... s.php#L799
AOChatProxy: https://github.com/bigwheels16/TyrLib/b ... e.java#L46

As you can see, the Budabot version handles a lot more "data types" than the AOChatProxy does. And in fact, in the second link on line 73 you can see the exception that is appearing in your logs. So, basically, when AO sends a certain packet that the AOChatProxy doesn't understand, it can't handle it and it crashes.

I believe this is the code that needs to be added:

Code: Select all

case 'l':
   byte[] instanceBytes = new byte[4];
   dataInputStream.readFully(instanceBytes);
   long instanceId = Helper.bytesToLong(instanceBytes);
   long categoryId = 20000;
   params.add(MMDBParser.getMessage(categoryId, instanceId));
   break;


I don't have time to build it right now, but if you check back in a few days I will try to have a new version for you to download and try.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
westnile
Member
Posts: 4
Joined: Tue Sep 09, 2014 6:54 am
antispam: rimor

Re: Quick Question

Postby westnile » Tue Sep 09, 2014 4:14 pm

Ah ok I am far from a coder and first instinct when the whole net got lagged was to look at it from my aspect.

Thanks for taking the time to read my weird situation and I'll keep a eye open for that.
Tyrence
The Team
Posts: 1883
Joined: Sat Jan 09, 2010 1:32 am

Re: Quick Question

Postby Tyrence » Wed Sep 10, 2014 8:25 am

OK, I think I have a fix for your problem.

In your aochatproxy folder there is a file called tyrlib.jar. You need to move that file out of that directory and replace it with the jar file that I've attached to this post (extract the jar from the zip--don't put the zip in the folder directly; the name must stay as tyrlib.jar). I would keep a backup of the old file in case the new file doesn't work. I haven't tried this code myself because I no longer have any of my development stuff set up for AO so you will have to test it for me.

Note that you won't know that it's fixed except that it shouldn't crash anymore. So you'll just have to wait a few days to see if you still get the problem. And if it does work, please let me know so that I can include the updated lib in the download. Thanks.

EDIT: I realized the first version of the file I uploaded wouldn't work. I have more confidence that this new version that I attached to this post will work.
Attachments
tyrlib.zip
(76.85 KiB) Downloaded 94 times
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
westnile
Member
Posts: 4
Joined: Tue Sep 09, 2014 6:54 am
antispam: rimor

Re: AOChatProxy Problem

Postby westnile » Sat Sep 13, 2014 9:32 am

I just updated the file been having a hetic week I'll let you know if it stays as stable as it has been so far in 24 hours roughly just to give it some time to really run and such.
westnile
Member
Posts: 4
Joined: Tue Sep 09, 2014 6:54 am
antispam: rimor

Re: AOChatProxy Problem

Postby westnile » Sat Sep 13, 2014 8:45 pm

Ok bot is running smoothly but i think some time after I went to bed finally it had a hiccup

2014-09-13 02:30:56,076 INFO [main] (Program.scala:43) - Ready to accept a mast
er bot on port 9993
2014-09-13 02:31:08,489 INFO [clientHandler] (ClientHandler.scala:114) - starti
ng proxy bot main
2014-09-13 02:31:08,512 INFO [clientHandler] (ClientHandler.scala:114) - starti
ng proxy bot slave1
2014-09-13 05:59:55,678 ERROR [chatPacketListener] (ChatPacketListener.java:45)
- Bot Character: 'name removed' packet id: '37'
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeExcepti
on: Unknown Reference Type -- Could not find instance. categoryId: '20000' insta
nceId: '264474563'
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:33)
at com.jkbff.ao.tyrlib.packets.server.SystemMessage.<init>(SystemMessage
.java:30)
at com.jkbff.ao.tyrlib.packets.BaseServerPacket.createInstance(BaseServe
rPacket.java:45)
at com.jkbff.ao.tyrlib.chat.ChatPacketListener.run(ChatPacketListener.ja
va:38)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unknown Refer
ence Type -- Could not find instance. categoryId: '20000' instanceId: '264474563
'
at com.jkbff.ao.tyrlib.chat.MMDBParser.getMessage(MMDBParser.java:32)
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.parseParams(ExtendedMessa
ge.java:104)
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:31)
... 3 more
Caused by: java.lang.RuntimeException: Unknown Reference Type -- Could not find
instance. categoryId: '20000' instanceId: '264474563'
at com.jkbff.ao.tyrlib.chat.MMDBParser.getMessage(MMDBParser.java:24)
... 5 more
2014-09-13 05:59:55,771 ERROR [chatPacketListener] (ChatPacketListener.java:45)
- Bot Character: 'name removed' packet id: '37'
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeExcepti
on: Unknown Reference Type -- Could not find instance. categoryId: '20000' insta
nceId: '264474563'
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:33)
at com.jkbff.ao.tyrlib.packets.server.SystemMessage.<init>(SystemMessage
.java:30)
at com.jkbff.ao.tyrlib.packets.BaseServerPacket.createInstance(BaseServe
rPacket.java:45)
at com.jkbff.ao.tyrlib.chat.ChatPacketListener.run(ChatPacketListener.ja
va:38)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unknown Refer
ence Type -- Could not find instance. categoryId: '20000' instanceId: '264474563
'
at com.jkbff.ao.tyrlib.chat.MMDBParser.getMessage(MMDBParser.java:32)
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.parseParams(ExtendedMessa
ge.java:104)
at com.jkbff.ao.tyrlib.packets.ExtendedMessage.<init>(ExtendedMessage.ja
va:31)
... 3 more
Caused by: java.lang.RuntimeException: Unknown Reference Type -- Could not find
instance. categoryId: '20000' instanceId: '264474563'
at com.jkbff.ao.tyrlib.chat.MMDBParser.getMessage(MMDBParser.java:24)
... 5 more
Tyrence
The Team
Posts: 1883
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Mon Sep 15, 2014 3:33 am

Hmm, we got further. But the problem this time is that it can't find the message with that ID. The messages come from the /Anarchy Online/cd_image/text/text.mdb. I included a copy of that file with the AOChatProxy. However, even with the latest version of that file, I can't find a message with that ID either. So I am not sure what the problem is. It could be that I am reading the value wrong. However, I compared the way AOChatProxy reads the value to the way Budabot reads it, and several other bots, and they all read it the same way. Another option is that it's a bug in AO, maybe caused by a recent release. Or maybe Funcom changed how the messageID is read from the stream or where to look for the message.

The packet is a SystemMessage. A good example of a SystemMessage is the "Welcome to Anarchy Online" message. Also, "Player offline" and "Player inbox full" are other examples of SystemMessages (I think, not 100% without looking). Anyway, if notice a SystemMessage in your client that happens at the same time the error occurs, that could give us a clue.

In any case, I can create a version of the library that won't error when it encounters this situation so at least the bot will continue to work. Give me a few days for that.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
The Team
Posts: 1883
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Fri Sep 19, 2014 6:15 am

OK, here is the new version. Same process as last time. Note that this will still show errors in the log, and I would appreciate it if you could post the logs when you get those errors. However, the errors should no longer cause it to crash so the bot and the chat proxy should no longer go down.
Attachments
tyrlib.zip
(77.23 KiB) Downloaded 196 times
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Intyl
Member
Posts: 60
Joined: Tue Sep 27, 2011 8:06 pm
antispam: Rimor

Re: AOChatProxy Problem

Postby Intyl » Wed Dec 07, 2016 11:35 am

Argh. Tried real hard to download this... Corrupt archive :( on both... See the issue in our aoChatproxy..

/I
Tyrence
The Team
Posts: 1883
Joined: Sat Jan 09, 2010 1:32 am

Re: AOChatProxy Problem

Postby Tyrence » Thu Dec 15, 2016 6:47 pm

Ohhhh, I see. I will see if I can find a copy of that I can send you.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases

Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest