Skip Menu |
 

This queue is for tickets about the Bot-BasicBot CPAN distribution.

Report information
The Basics
Id: 99133
Status: rejected
Priority: 0/
Queue: Bot-BasicBot

People
Owner: Nobody in particular
Requestors: MORITZ [...] cpan.org
Cc: tadzikes [...] gmail.com
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.89
Fixed in: (no value)



CC: tadzikes [...] gmail.com
Subject: First response of bots based on Bot::BasicBot is very slow
Download (untitled) / with headers
text/plain 897b
When a non-trivial bot based on Bot::BasicBot returns a string from method "said", there is a very noticable delay (between 5s and 10s I'd guess) between returning the string, and the bot printing the response in the channel. This delay only happens the first time a non-empty string is returned; it's gone on subsequent executions. Sadly, I can't reproduce the problem with a very simplistic bot; one project that exhibits it is https://github.com/perl6/evalbot/ and can be easily observed by inserting a warn() statement before the return() here: https://github.com/perl6/evalbot/blob/98c9ae5d47f67f87beef212b2f7b1a51177ebd76/evalbot.pl#L270 Observing both the console that the bot runs on an the IRC channel makes the delay obvious. I thought this was a quirk introduced by the weird things that evalbot does, but it seems I'm not alone: http://irclog.perlgeek.de/perl6/2014-09-25#i_9409316
Download (untitled) / with headers
text/plain 341b
I cloned evalbot, configured it and added a simple perl(1) executor (see attached diff). Yet the first reply I got was instantaneous: 18:15:10 -!- evalbothlagh [~p6eval@a83-163-60-106.adsl.xs4all.nl] has joined #testinghlagh 18:16:29 <literal> p5: print 5 18:16:29 <evalbothlagh> p5: OUTPUT«5» So I'm not sure what the issue could be...
Subject: test.patch
Download test.patch
text/x-diff 967b
diff --git a/evalbot.pl b/evalbot.pl index 3ab2ffd..5812715 100755 --- a/evalbot.pl +++ b/evalbot.pl @@ -179,6 +179,10 @@ Q:PIR { revision => sub { get_revision_from_file("$home/std/snap/revision")}, nolock => 1, }, + p5 => { + cmd_line => 'perl %program', + nolock => 1, + }, 'p5-to-p6' => { chdir => "$home/Perlito", cmd_line => "perl perlito5.pl --noboilerplate -I./src5/lib -Cperl6 %program", diff --git a/freenode.org.conf b/freenode.org.conf index ed72d8d..bdea931 100644 --- a/freenode.org.conf +++ b/freenode.org.conf @@ -1,5 +1,5 @@ server = irc.freenode.org -channels = perl6 november-wiki swhack dbdi perl6book perl-kr rosettacode moarvm learnprogramming -nick = camelia +channels = testinghlagh +nick = evalbothlagh alt_nicks = p6eval p6_eval pass = WFkuDV17A6Jhj
Download (untitled) / with headers
text/plain 100b
Oh, actually, if I issue the command right after it goes online, I do get the delay. Interesting....
Download (untitled) / with headers
text/plain 687b
I'm pretty sure this is caused by flood protection in POE::Component::IRC: https://github.com/bingos/poe-component-irc/blob/master/lib/POE/Component/IRC.pm#L1079 If I turn it off, the delay goes away. You can do so by adding the following to your Evalbot->connected() method: $bot->pocoirc->{flood} = 1; Also, you can run the bot with POCOIRC_DEBUG=1 to see the commands it sends to the IRC server. What causes it to delay sending the first reply are the PRIVMSG to nickserv, along with the WHO and MODE commands sent after first join the channel(s). Whether the flood protection code can afford to be less conservative is another issue. It was written ages ago, so it's possible.
CC: tadzikes [...] gmail.com
Subject: Re: [rt.cpan.org #99133] First response of bots based on Bot::BasicBot is very slow
Date: Thu, 25 Sep 2014 21:24:19 +0200
To: bug-Bot-BasicBot [...] rt.cpan.org, MORITZ [...] cpan.org
From: Moritz Lenz <moritz [...] faui2k3.org>
Download (untitled) / with headers
text/plain 985b
Hi, On 25.09.2014 20:42, Hinrik Orn Sigurdsson via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=99133 > > > I'm pretty sure this is caused by flood protection in POE::Component::IRC:
That makes sense. evalbot usually joins several channels, which means it sends many more messages. Show quoted text
> https://github.com/bingos/poe-component-irc/blob/master/lib/POE/Component/IRC.pm#L1079 > > If I turn it off, the delay goes away. You can do so by adding the following to your Evalbot->connected() method: > > $bot->pocoirc->{flood} = 1; > > Also, you can run the bot with POCOIRC_DEBUG=1 to see the commands it sends to the IRC server. What causes it to delay sending the first reply are the PRIVMSG to nickserv, along with the WHO and MODE commands sent after first join the channel(s). > > Whether the flood protection code can afford to be less conservative is another issue. It was written ages ago, so it's possible.
Thanks, I'll experiment with that. Cheers, Moritz
Download (untitled) / with headers
text/plain 789b
Some would consider this a slightly late reply, but yes, I think this is down to flood protection - when the bot hasn't been online for long, it'll be doing a WHO on each channel, etc, so its send queue might be a bit higher - so Poco::IRC's flood protection will be dispatching messages with delays to stop the bot flooding itself off. Once it's "settled in", things should be quicker (unless someone is messaging the bot and prompting it to send multi-line help texts, etc, which could increase the queue again). So, I'd consider this not a bug. I sort of wonder if it could do with a console mode status output that displays statistics (channels joined, send queue length, etc), or the ability to send the same to a status file regularly, as it could make this kind of thing clearer.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.