cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Question: Channel getting out of sync. #130

Closed jhaals closed 11 years ago

jhaals commented 11 years ago

First of all, I'm super happy with cinch, very stable and easy to use. I wanted to create new bot for a logging project but I ran into some problems with the sync.

Basically existing channels in the database works without problem but as soon as a new channel is created and the bot tries to query for the channel it gets stuck. I tried the class standalone and that works fine. Probably how I (don't) handle the threads.

The chinch plugin: https://gist.github.com/JHaals/6088265

The error message(s)

[2013/07/26 13:28:08.094] >> :jhaals!jhaals@foo.bar PRIVMSG #jhaals2 :oo
[2013/07/26 13:28:08.094] !! [New thread] For #<Cinch::Handler @event=:message pattern=#<Cinch::Pattern:0x007fe2329d7e18 @prefix=nil, @pattern=//, @suffix=nil>>: #<Thread:0x007fe23214af98> -- 1 in total.
 ~ (0.004256) SELECT "id", "name", "private" FROM "channels" WHERE "name" = '#jhaals2' ORDER BY "id" LIMIT 1
[2013/07/26 13:28:18.107] !! A synced attribute ('topic' for #<Channel name="#jhaals2">) has not been available for 10 seconds, still waiting
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/syncable.rb:67:in `attr'
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/rubyext/module.rb:10:in `block in synced_attr_reader'
[2013/07/26 13:28:18.107] !!   bigBrother.rb:38:in `block in listen'
[2013/07/26 13:28:18.107] !!   <internal:prelude>:10:in `synchronize'
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/bot.rb:164:in `synchronize'
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/plugin.rb:462:in `synchronize'
[2013/07/26 13:28:18.107] !!   bigBrother.rb:33:in `listen'
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/plugin.rb:318:in `block (2 levels) in __register_listeners'
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/handler.rb:88:in `call'
[2013/07/26 13:28:18.107] !!   /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.5/lib/cinch/handler.rb:88:in `block in call'```
dominikh commented 11 years ago

So, that channel you are requesting the topic for: Is the bot in the channel when requesting the topic, or is it not in the channel?

jhaals commented 11 years ago

It's in the channel, could it work if I remove topic? On Jul 26, 2013 6:46 PM, "Dominik Honnef" notifications@github.com wrote:

So, that channel you are requesting the topic for: Is the bot in the channel when requesting the topic, or is it not in the channel?

— Reply to this email directly or view it on GitHubhttps://github.com/cinchrb/cinch/issues/130#issuecomment-21633075 .

dominikh commented 11 years ago

It would work, yes, but you're only removing a symptom that way. It's likely to be a bug in Cinch.

Does the channel actually have a topic or is it blank?

jhaals commented 11 years ago

It's actually without topic. I tried setting the topic and then it worked :o

On Fri, Jul 26, 2013 at 7:14 PM, Dominik Honnef notifications@github.comwrote:

It would work, yes, but you're only removing a symptom that way. It's likely to be a bug in Cinch.

Does the channel actually have a topic or is it blank?

— Reply to this email directly or view it on GitHubhttps://github.com/cinchrb/cinch/issues/130#issuecomment-21634789 .

dominikh commented 11 years ago

okay, thanks, that helped pin down the bug. Will be fixed soon.

jhaals commented 11 years ago

Great news. Thank you!

jhaals commented 11 years ago

Did you release a new version? I just tried running 2.0.6. This channel has a topic.

[2013/07/29 10:11:43.524] >> :jhaals!jhaals@foo PRIVMSG #foobaar :< [2013/07/29 10:11:43.525] !! [New thread] For #<Cinch::Handler @event=:message pattern=#<Cinch::Pattern:0x007fe6a8fe8300 @prefix=nil, @pattern=//, @suffix=nil>>: #<Thread:0x007fe6ab00aac0> -- 2 in total. ~ (0.000550) SELECT "id", "name", "private" FROM "channels" WHERE "name" = '#foobaar' ORDER BY "id" LIMIT 1 [2013/07/29 10:11:43.526] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/channel.rb:62:inblock in initialize': undefined method attribute_synced?' for #<Channel name="#foobaar"> (NoMethodError) [2013/07/29 10:11:43.526] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/syncable.rb:65:incall' [2013/07/29 10:11:43.526] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/syncable.rb:65:in attr' [2013/07/29 10:11:43.526] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/rubyext/module.rb:10:inblock in synced_attr_reader' [2013/07/29 10:11:43.526] !! bigBrother.rb:38:in block in listen' [2013/07/29 10:11:43.526] !! <internal:prelude>:10:insynchronize' [2013/07/29 10:11:43.526] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/bot.rb:164:in synchronize' [2013/07/29 10:11:43.527] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/plugin.rb:462:insynchronize' [2013/07/29 10:11:43.527] !! bigBrother.rb:33:in listen' [2013/07/29 10:11:43.527] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/plugin.rb:318:inblock (2 levels) in __register_listeners' [2013/07/29 10:11:43.527] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/handler.rb:88:in call' [2013/07/29 10:11:43.527] !! /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/cinch-2.0.6/lib/cinch/handler.rb:88:inblock in call' [2013/07/29 10:11:43.527] !! [Thread done] For #<Cinch::Handler @event=:message pattern=#<Cinch::Pattern:0x007fe6a8fe8300 @prefix=nil, @pattern=//, @suffix=nil>>: # -- 1 remaining.`

dominikh commented 11 years ago

sigh Messed up the fix because of differences between the maintenance and master branch. Update to 2.0.7 and it should be fixed.