Closed dieterdemeyer closed 10 years ago
Just to note, the bot is offline in the room it joined in, but one on one talks seem to work, although still appearing offline...
Can you provide some logs of the crash?
It doesn't actually crash... I keep getting messages in the output like below but the bot appears offline in the room and it doesn't respond to messages anymore..
[DEBUG][2013-09-17 19:36:17 +0200] SENDING:
[DEBUG][2013-09-17 19:37:17 +0200] SENDING:
[DEBUG][2013-09-17 19:38:17 +0200] SENDING:
[DEBUG][2013-09-17 19:39:17 +0200] SENDING:
[DEBUG][2013-09-17 19:40:17 +0200] SENDING:
[DEBUG][2013-09-17 19:41:17 +0200] SENDING:
[DEBUG][2013-09-17 19:42:17 +0200] SENDING:
[DEBUG][2013-09-17 19:43:17 +0200] SENDING:
[DEBUG][2013-09-17 19:44:17 +0200] SENDING:
[DEBUG][2013-09-17 19:45:17 +0200] SENDING:
What's the last logged thing apart from this? It's just a server pinging. You can try setting up the exception handler:
on_error do |error|
# notify by airbrake/rollbar/email/etc.
end
I'm going to check this again, but at home the bot has been running for more than 3 hours.. At work, it seems to disconnect. Could just be a network problem at work, then...
Let us know if the problem still occurs.
BTW I've just updated the readme, check if you have configured everything properly. Hope this helps.
I ran the bot from both my AWS instance and local machine. Both times, the bot disconnects after a period of time.. But no errors are shown in the logs..
I updated my bot instance with the error block from your README but when trying to send a command to the bot, I got the output shown in the following link: http://pastebin.com/jtAquSJN Is there something wrong with my initialization ?
hi @dieterdemeyer . The problem seems to be line 59 of bin/computing-hipbot - probably a typo "HipBot" where it should be "Hipbot". Can you post your code for reaction from this line?
That's what you get for copy pasting from the READMe :) I'll modify the code and see what comes out...
Hello,
I added the error block, and it works for showing errors when responding to messages from the bot... But when the bot disconnects, it doesn't show any errors... I keep getting messages in the output that shows it's pinging, but it appears offline. When reconnecting to the room through the Linux client, it still appears offline.. Don't really know what/how to debug from this point on..
@dieterdemeyer, Could you show us the last few lines of log before disconnecting? I can't think of anything better now.
@bartoszkopinski, You can find my complete output from starting the bot to disconnected from the room at the following link:
So basically thats the exception which was causing the problem:
Encoding::CompatibilityError
incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
/home/bkdem/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc2/lib/hipbot/message.rb:17:in `gsub'
/home/bkdem/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc2/lib/hipbot/message.rb:17:in `strip_recipient'
/home/bkdem/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc2/lib/hipbot/message.rb:8:in `initialize'
This should be handled and not break the connection - I'll push the fix for that later this week. I've added magic encoding comment to fix the issue, you can either upgrade to Ruby 2.0 or switch to master build. Let me know if that helps!
@bartoszkopinski,
When I use the master version, I get the following error when asking a question to my bot... http://pastebin.com/Ckszhx91 I'm currently using v1.0.0.rc2. I'll try it with my version, but with your changes applied.
@dieterdemeyer,
I think you're using array brackets in computing_bot.rb:44
, right?
I've changed that for compatibility reasons to find
and find_by
.
So basically if you had:
Hipbot::Room["room_name"]
it should be now:
Hipbot::Room.find_by(name: "room_name")
or
Hipbot::Room.find("room_jid")
The same goes for User
, check out storages/hash.rb
and Readme.
Sorry for confusion.
@bartoszkopinski, Thanks for your quick response...
I modified my code and the full stack trace is gone, however when sending 'hello' to the bot, I still get the folliowing:
[INFO][2013-09-25 20:09:44 +0200] MESSAGE from #<Hipbot::User:0x0000000446c180> in computing
[INFO][2013-09-25 20:09:44 +0200] REACTION #<Hipbot::Reaction {:regexps=>[/^hello/], :desc=>"hello - kindly greets the sender"}>
[ERROR][2013-09-25 20:09:44 +0200] undefined method `split' for nil:NilClass
Is there any way to see where exactly it's going wrong ? Since I'm using v1.0.0.rc2, are there any major refactoring I need to do to get the current master working ?
Thanks in advance...
@bartoszkopinski,
Actually, maybe it's just a problem with one of the plugins
desc 'hello - kindly greets the sender'
on /^hello/ do
#reply("hello #{sender.first_name}!") #gives error above
reply("hello #{sender.mention}!") #gives eror undefined method `gsub' for nil:NilClass
end
It seems some of the methods of the sender object can't be used...
@dieterdemeyer , Looks like, for some reason, your user object is missing a name. Hipbot is using such blank user object if sender is not found in ones it got from HipChat. Probably something went wrong with initialization... Can you see any errors pop up whilst connecting?
I'll be pushing some major updates soon, maybe that will fix this problem.
@bartoszkopinski,
Looking at the output I don't see any errors...
When I output #{sender}
in a reply, it actually does give me a User object but calling methods like first_name, mention,... on that object are giving the errors..
@dieterdemeyer,
You could try to debug this by listing all users got from server Hipbot::User.all.map(&:name)
... It fetches them on start so you can grep boot logs for your name and see if there is something.
Also update hipbot and plugins to master version and let us know if that helps.
I'll try that. On a side note, your encoding fix seems to work. My bot has been online for a few hours now without disconnects.
I updated to the master version of hipbot, built and installed the gem. I added a method to list the users, but when I call this method, I get the following error:
undefined method `all' for Hipbot::User:Class
undefined method `all' for Hipbot::User:Class raised by list all users from #<Hipbot::User:0x007f743c26d8f8> in computing
Also, when working with the sender variable, I get the error
undefined method `split' for nil:NilClass raised by hello from #<Hipbot::User:0x007f743c1bba90> in computing
undefined method `split' for nil:NilClass
when calling sender.first_name.
But I don't see any errors in the logs...
How does your config look like? Hipbot::User
should inherit from hash storage, and the all
method is defined here.
I use the master branch of hipbot but the user.rb located at https://github.com/pewniak747/hipbot/blob/master/lib/hipbot/user.rb doesn't inherit from anything... Or am I looking at the wrong class ?
@dieterdemeyer, Sorry it took so long. I've just run into this bug and fixed it in master, it should be working now.
@bartoszkopinski , when I update to master, I get the following error when starting my bot:
E, [2013-10-29T09:22:05.626201 #14285] ERROR -- : [ERROR][2013-10-29 09:22:05 +0100] undefined method `on_room_message' for #<Jabber::MUC::HipchatClient:0x00000001cc5f50>
^C/home/bkdem/.rvm/gems/ruby-1.9.3-p392/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine': Interrupt
from /home/user/.rvm/gems/ruby-1.9.3-p392/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
from /home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/bot.rb:46:in `start!'
from computing_bot.rb:50:in `<main>'
@dieterdemeyer can you take a look at it now?
@bartoszkopinski, pulled from master and installed new version.. Bot starts but when asking something like '@bot help', I get:
<message from='xxx@chat.hipchat.com/Automation Bot' to='xxx@conf.hipchat.com' type='groupchat' xmlns='jabber:client'><body></body><subject/></message>
D, [2013-10-29T10:55:29.467116 #18840] DEBUG -- : [DEBUG][2013-10-29 10:55:29 +0100] RECEIVED:
<message from='xxx@conf.hipchat.com' to='xxx@chat.hipchat.com/none' type='error'><body/><subject/><error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Message body is required.</text></error></message>
D, [2013-10-29T10:55:29.469104 #18840] DEBUG -- : [DEBUG][2013-10-29 10:55:29 +0100] PROCESSING:
<message from='xxx@conf.hipchat.com' to='xxx@chat.hipchat.com/none' type='error' xmlns='jabber:client'><body/><subject/><error code='400' type='modify'><bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Message body is required.</text></error></message> (Jabber::Message)
D, [2013-10-29T10:55:29.469165 #18840] DEBUG -- : [DEBUG][2013-10-29 10:55:29 +0100] TRYING stanzacbs...
D, [2013-10-29T10:55:29.469215 #18840] DEBUG -- : [DEBUG][2013-10-29 10:55:29 +0100] TRYING message/iq/presence/cbs...
@dieterdemeyer you're the best bug spotter ever :) should be fixed now.
@bartoszkopinski Thx :)
Don't be mad but I Installed the new version and when calling the bot, the following occurs:
D, [2013-10-29T20:33:40.259419 #6188] DEBUG -- : [DEBUG][2013-10-29 20:33:40 +0100] PROCESSING:
<message from='44882_cegeka@conf.hipchat.com/Dieter De Meyer' to='44882_304168@chat.hipchat.com/none' type='groupchat' xmlns='jabber:client'><body>@jarvis help</body></message> (Jabber::Message)
D, [2013-10-29T20:33:40.259497 #6188] DEBUG -- : [DEBUG][2013-10-29 20:33:40 +0100] TRYING stanzacbs...
D, [2013-10-29T20:33:40.259547 #6188] DEBUG -- : [DEBUG][2013-10-29 20:33:40 +0100] TRYING message/iq/presence/cbs...
I, [2013-10-29T20:33:40.259974 #6188] INFO -- : [INFO][2013-10-29 20:33:40 +0100] MESSAGE from Dieter De Meyer in computing
W, [2013-10-29T20:33:40.260281 #6188] WARN -- : [WARN][2013-10-29 20:33:40 +0100] EXCEPTION:
NoMethodError
undefined method `prepend' for []:Array
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:21:in `block in reaction_sets'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:20:in `each'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:20:in `each_with_object'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:20:in `reaction_sets'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:27:in `message_matches'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:5:in `react'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/bot.rb:11:in `method_missing'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/room_message.rb:9:in `block (2 levels) in initialize'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/base.rb:11:in `with_user'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/room_message.rb:7:in `block in initialize'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/base.rb:7:in `with_room'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/room_message.rb:5:in `initialize'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/adapters/hipchat/initializer.rb:67:in `new'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/adapters/hipchat/initializer.rb:67:in `block in initialize_callbacks'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:61:in `call'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:61:in `block (3 levels) in <class:HipchatClient>'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `call'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `block in process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `each'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:221:in `handle_group_message'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:196:in `handle_message'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:128:in `block in activate_callbacks'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `call'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `block in process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `each'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:277:in `receive'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/streamparser.rb:62:in `block in parse'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `call'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `block in parse'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `each'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `parse'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/streamparser.rb:79:in `parse'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:75:in `block in start'
W, [2013-10-29T20:33:40.260414 #6188] WARN -- : [WARN][2013-10-29 20:33:40 +0100] Exception caught in Parser thread! (NoMethodError)
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:21:in `block in reaction_sets'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:20:in `each'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:20:in `each_with_object'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:20:in `reaction_sets'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:27:in `message_matches'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/matchable.rb:5:in `react'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/bot.rb:11:in `method_missing'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/room_message.rb:9:in `block (2 levels) in initialize'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/base.rb:11:in `with_user'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/room_message.rb:7:in `block in initialize'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/base.rb:7:in `with_room'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/callbacks/room_message.rb:5:in `initialize'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/adapters/hipchat/initializer.rb:67:in `new'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/hipbot/adapters/hipchat/initializer.rb:67:in `block in initialize_callbacks'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:61:in `call'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:61:in `block (3 levels) in <class:HipchatClient>'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `call'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `block in process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `each'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:221:in `handle_group_message'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:196:in `handle_message'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/hipbot-1.0.0.rc4/lib/xmpp4r/muc/hipchat_client.rb:128:in `block in activate_callbacks'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `call'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:99:in `block in process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `each'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/callbacks.rb:98:in `process'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:277:in `receive'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/streamparser.rb:62:in `block in parse'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `call'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `block in parse'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `each'
/home/user/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:142:in `parse'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/streamparser.rb:79:in `parse'
/home/user/.rvm/gems/ruby-1.9.3-p392/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:75:in `block in start'
D, [2013-10-29T20:33:40.260574 #6188] DEBUG -- : [DEBUG][2013-10-29 20:33:40 +0100] TRYING TO CLOSE, STILL PROCESSING 1 STANZAS
D, [2013-10-29T20:33:40.260669 #6188] DEBUG -- : [DEBUG][2013-10-29 20:33:40 +0100] TRYING TO CLOSE, STILL PROCESSING 1 STANZAS
D, [2013-10-29T20:33:40.260760 #6188] DEBUG -- : [DEBUG][2013-10-29 20:33:40 +0100] TRYING TO CLOSE, STILL PROCESSING 1 STANZAS
You were faster than my push :) Fixed and I'm going to write more tests now.
@bartoszkopinski , I ran my bot for several hours today but I'm sad to say it disconnected after a while.. I'll try it again and provide you with the output, should you be willing to take a look..
@dieterdemeyer some bugs which may have caused disconnecting were just fixed. Let us know if you find anything in logs.
Hello,
When using hipbot, the bot seems to disconnect after some period of time. I can't say when exactly...
Did anyone experience this before ?
Regards.