Anope IRC Services

Anope Development => Modules => Topic started by: chasingsol on February 12, 2006, 06:18:44 PM

Title: [Request] fix cs_chanlimit
Post by: chasingsol on February 12, 2006, 06:18:44 PM
Greetings all,

As some of you are aware, Trystan spent a great deal of time working on a module I commissioned to create a channel limit module that mimics the functionality of the common channel limiting eggdrop script. Unfortunately, while the module is completed there is a lockup problem that manifests itself. Trystan is unsure where this is occurring. Full details can be found on the prior SearchIRC forum at http://searchirc.com/boards/viewtopic.php?t=4515

I'd like to respectfully request the Anope developers take a look. This module is extremely useful and I believe it would be a popular module for additional functionality in channel control.

I've taken the liberty of hosting the file on my own bandwidth, out of deference to Trystan. The original links can still be found within the above link.

cs_chanlimit.tar.gz (http://www.p2p-irc.net/anope/cs_chanlimit.tar.gz)

**Warning** This module WILL make your Anope freeze up! Not for Anope 1.6.x

Cheers,

Mark
chasingsol @ irc.p2p-irc.net

[Edited on 2-12-2006 by chasingsol]
Title:
Post by: Tom65789 on February 12, 2006, 06:25:14 PM
yer that is one awesome module, it dont work right for some reason for me :<

it puts the +l down once then stops doesnt put the +l up either and no this isnt a full lock of the services as everything else still functions.

this is one wierd module and yes its in need of work but i thank Trystan for such an excellent module
Title:
Post by: SkaterStuff on February 13, 2006, 05:36:27 PM
hmm i don't use the anope one but i do have one that is called limitserv :) and works good.
Title:
Post by: Tom65789 on February 14, 2006, 03:59:45 PM
i have noticed when i had cs_ihabitregistered loaded AND cs_chanlimit loaded and running in a few Channels it wasnt locking up and has been working sort of ok, with the exception of it not including itself in the +l so u have to increase it by 6 each time to get the 5 spread, just it doesnt always change the limit so its good and bad in its ways
Title:
Post by: chasingsol on February 15, 2006, 05:41:50 AM
If one of the devs is willing, I might be up to commissioning this modules completion. Please drop me a line.

Cheers,

Mark.
Title:
Post by: Dave Robson on February 15, 2006, 08:10:40 AM
I did give it a try, but when i loaded it up, it just plain didnt work it was obviously something i was doing/something in my setup but i didnt spend any length of time trying to find out what.

Are there any special settings it needs? for example, i had users join/parting the channel, and it did nothing (cept the initial +l when i turned it on) if so i can set them and give it another look - all i wanted to see was the freezing problem :)
Title:
Post by: Tom65789 on February 15, 2006, 04:28:05 PM
i had that same issue Rob it only changed the +l on turning on and off, but this wasnt a full lock up of the services for me as everything else functioned fine
Title:
Post by: chasingsol on February 18, 2006, 01:08:24 AM
Well, I guess the question is.. would anyone be willing to give writing this module a go? It would be a good addition.
Title:
Post by: Trystan Scott Lee on February 18, 2006, 02:10:10 AM
okay I am going to work on it again.. without the internal anope callback stuff which is where I fear the problem has been all along.. which will kinda make the timer system useless and less like the eggdrops but would avoid any core problems
Title:
Post by: SkaterStuff on February 18, 2006, 02:18:46 AM
But wont that slow it down?
Title:
Post by: Trystan Scott Lee on February 18, 2006, 02:22:55 AM
No.. the callback() functions are the slow point, they have to be set, the core then has to keep track of them and call them back. Without times the mode would be set right there and there and there is no waiting and perphas lock up in the core due to some issue, and this way its out of the core and straight module so if it locks up it would be clearly in the module doing some thing in a loop which the code doesn't have
Title:
Post by: Tom65789 on February 18, 2006, 10:56:39 AM
hey Trystan i know this is a big thing to ask, but could you add an option so it HAS to be on in all channels and only IRC Operators can turn it off change the variance and such like, but make it optional as not everyone will want it.
Title:
Post by: Trystan Scott Lee on February 28, 2006, 01:38:22 AM
Okay since I about broke my ankle on sunday.. and can't move around worked on chanlimit a bit, some minor tweaks, more debug messages and also set it up so that you don't have to use the internal anope call back.

1.0.5
- Fixed defines not showing what function was being called
- new option ChanLimitNoTimers to not use the core Anope timers and just go straight to
  setting the mode.
- removed debug: from in front of the config file alog() messages
- show the module name and extension in the debug messages.
- on module load it will set the modes on channels

http://www.nomadinc.net/mymods/chanlimit/cs_chanlimit.c
http://www.nomadinc.net/mymods/chanlimit/cs_chanlimit.h
http://www.nomadinc.net/mymods/chanlimit/readme.txt
Title:
Post by: Tom65789 on February 28, 2006, 03:03:25 AM
nice work Trystan, sorry to hear about your ankle though, hope it gets better soon

but i get an error when trying to compile and its 3AM now lol

Code: [Select]

cs_chanlimit.c
cs_chanlimit.c(251) : error C2065: '__PRETTY_FUNCTION__' : undeclared identifier

NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'

[Edited on 28-2-2006 by Tom65789]
Title:
Post by: chasingsol on February 28, 2006, 03:07:10 AM
Same, hope you get better soon.

Regarding this, you say you've removed calling the Anope timers... does that mean there are no timers at all and changes are instant, or have you incorporated your own? I ask since I ended up trying out LimitServ with NeoStats 3, which worked, but alpha software is alpha for a good reason, so that lasted less than 24 hours. I really want this functionality in Anope, since it's a better fit rather than installing an entire package to do one thing, but need to know if I'm going to lock up services before so I know what to expect!

Thanks again!
Title:
Post by: Tom65789 on February 28, 2006, 03:17:05 AM
its optional now, you can remove the timers by putting "ChanLimitNoTimers" into the Services.conf file otherwise there will be timers
Title:
Post by: Trystan Scott Lee on February 28, 2006, 03:22:40 AM
This option removes using timers (callbacks) period in the module, problem with modules is that they can't run on a loop timer like the core can, they must use the callback system. the option now just sets the mode, if that works prefectly then its down to the callback code which I can't control from a module.

Tom.. yeah damm winshit.. okay will fix for win32
Title:
Post by: chasingsol on February 28, 2006, 06:42:42 AM
Ok, understood. Will try the module tomorrow when I can monitor it, rather than cratering services overnight and coming back to a few thousands pm's.
Title:
Post by: Dave Robson on February 28, 2006, 07:56:57 AM
After all the various comments about problems with callbacks and in the core etc, i tried to get this module to work, but something must be screwy in my conf or something, so wrote another limit module using module callbacks and module data etc... So far i've not seen any lockups (we're using it in #anope atm), if anyone who had the lockup issue could try it out just as a test and let me know?  :/

http://www.anope.org/modules/cs_limit.c

http://www.anope.org/modules/cs_limit.zip ( win32 dll for 1.7.13-svn.969 )

if anyone can get this to lockup or anything and has a bit of time to kill helping me debug what is wrong - i'll give you a virtual cookie*




* cookie may not actaully exist.


[Edited on 28-2-2006 by Rob]
Title:
Post by: Tom65789 on February 28, 2006, 08:07:36 AM
Quote
Originally posted by Trystan
This option removes using timers (callbacks) period in the module, problem with modules is that they can't run on a loop timer like the core can, they must use the callback system. the option now just sets the mode, if that works prefectly then its down to the callback code which I can't control from a module.

Tom.. yeah damm winshit.. okay will fix for win32


i hate windows too, but people who try this on windows are gonna be asking. THanks for the great work Trystan
Title:
Post by: Caustic on February 28, 2006, 11:50:22 AM
i got this error when compile it


 -I../../include -c cs_limit.c
cs_limit.c: In function `AnopeInit':
cs_limit.c:100: error: `EVENT_CHAN_KICK' undeclared (first use in this function)
cs_limit.c:100: error: (Each undeclared identifier is reported only once
cs_limit.c:100: error: for each function it appears in.)
cs_limit.c: In function `managed_add_channel':
cs_limit.c:347: error: syntax error at end of input
cs_limit.c:333: warning: unused variable `timeou'
cs_limit.c:332: warning: unused variable `buff'
make[1]: *** [cs_limit.o] Error 1
make[1]: Leaving directory `/home/pusluircd/anope/src/modules'
make: *** [modules] Error 2
Title:
Post by: Dave Robson on February 28, 2006, 01:04:04 PM
It needs svn, i dont know exactly which version, im using Anope-1.7.13-svn: (962)
Title:
Post by: chasingsol on March 10, 2006, 02:45:13 PM
Ok, tried this. One suggestion, it drops the limit as soon as someone leaves... possible to keep this to within the timeout period? Gets very messy during a netsplit.

[Edited on 3-10-2006 by chasingsol]
Title:
Post by: Dave Robson on March 10, 2006, 02:56:14 PM
it shouldnt get messy, there is a 2 second timer on parts, if it see's more than 1 in that time it will wait and make 1 mode change.

*edit* sorry a 1 second timer, i just checked - one second is more than enough for a netsplit situation tho.


[Edited on 10-3-2006 by Rob]
Title:
Post by: Tom65789 on March 10, 2006, 05:15:29 PM
i told you about this Rob :P

0.5 should be out soon(i hope :P)
Title:
Post by: chasingsol on March 11, 2006, 02:22:32 AM
One more request, and about the only thing I can think of, is the ability to set a max limit per channel that the module can set.

Other than that, it's running very well on my network (which is a decent size with plenty of traffic). Haven't noticed any buffer desynch after running all day, although it sometimes seems to be off by one (too low). Not a major problem, it corrects itself. It's not caused by a part, but appears to occur after a disconnect.

(Made a donation to Anope, thanks a lot guys!)

[Edited on 3-11-2006 by chasingsol]
Title:
Post by: Tom65789 on March 12, 2006, 12:24:05 AM
yer i have also told Rob about this.

i also asked him to do a special one for me if he had time, im not going to push him into making it though.

these are what i asked for:

- quits make it decrease by 1
- when a user is kicked and dont return decrease by 1
/* These Next options to be set in the Services.conf if the user wants them */
- restrict the LIMIT command to Service Admins, Staff, Roots, IRC opers (and not need SA to set it ON in someone elses channel)
- make it so its set ON default of a channel reg with the time and buffer specified in the config else 5:10
Title:
Post by: Tom65789 on March 12, 2006, 07:51:08 PM
0.5 Released:

Changes:

Now Decreases By 1 On Kick
Now Decreases By 1 On User Quit
Added Oper only access
Added to set ON when a channel is registered
Configurable .db name

--------------------------

Download From the Anope Modules Page

--------------------------

Config Options:

# CSLimitDBName [OPTIONAL]
#
#     Setting this directive will make Services use the given database
#     name for saving any cs_limit module settings into.

CSLimitDBName "cs_limit.db"


# CSLimitOperOnly [OPTIONAL]
#
#     When defined the cs_limit module will only allow opers to modify the limit
#     settings for channels

CSLimitOperOnly 1

# CSLimitDefaultBuffer [OPTIONAL]
#
#     When defined the cs_limit module will apply this buffer to all new channels
#     when they are registered. (note: requires CSLimitDefaultTimeout to be defined)

CSLimitDefaultBuffer 5

# CSLimitDefaultTimeout [OPTIONAL]
#
#     When defined the cs_limit module will apply this timeout to all new channels
#     when they are registered. (note: requires CSLimitDefaultBuffer to be defined)

CSLimitDefaultTimeout 5

[Edited on 12-3-2006 by Tom65789]
Title:
Post by: chasingsol on March 13, 2006, 12:01:49 AM
Excellent! Thank you Rob (and Tom65789 for reporting the update).

The module appears to not take in to account the presence of a BotServ bot in the channel, decreasing the available limit. With BotServ present, the buffer is off by 1 user. Solution of course is to raise the buffer by 1, but thought it should be reported.

Additionally, some method of viewing what cs_limit is currently set to (other than viewing the .db file) would be useful also.

[Edited on 3-13-2006 by chasingsol]
Title:
Post by: Tom65789 on March 13, 2006, 05:03:42 PM
These features were my Request to Rob lol. and i have payed him for doing a great job on it :) so thanks Rob

There is a work around on that that is pretty simple, rather than putting the buffer at +5 put it to +6 and then its correct

i had this same problem but it makes it easier because Anope doesnt see the module joins as for the Bots this is what Rob told me out of his kind heart :) "well botserv joins aint dealt with that would be a chance to the module, the line for other modules joining clients is a send_event() call"

just put the buffer to 6 rather than 5 to fix it :)

[Edited on 13-3-2006 by Tom65789]
Title:
Post by: chasingsol on March 23, 2006, 06:22:10 AM
Noticed a bug. On restart, it seems to change it's mind on what the limits are supposed to be. Below are contents of cs_limit.db

Before:
#GTN 6 60
#help 6 60
#p2p-irc.net 6 60
#pb.staff 5 5
#piratebits 6 60
#tpg 3 60

After:
#GTN 6 6
#help 6 6
#p2p-irc.net 6 6
#pb.staff 5 5
#piratebits 6 6
#tpg 3 3

[Edited on 3-23-2006 by chasingsol]
Title:
Post by: Tom65789 on March 23, 2006, 04:05:14 PM
hmm, yep the times reset but isnt 60 a bit too much? because if its a big channel 5 people may join within 60 seconds. i currently have mine a Buffer 6 Time 10, but its just my opinion :)
Title:
Post by: chasingsol on March 28, 2006, 09:12:19 PM
Depends on whether you think 10 seconds is long enough to react to a botnet joining. All you get is 10 seconds before the limit gets raised again and you get more bots joining.

I have several large (500+) user channels on my network (actual chat, not XDCC which isn't allowed), with a variance of 6 and timer of 60 seconds has never caused a problem with people not being able to join, but it's certainly stopped botnets.

Incidentally, we've modified the module to use the timer on both joins and parts/quit. Alleviated the complaints we got about continuous mode spam when someone would leave/quit.
Title:
Post by: Tom65789 on March 28, 2006, 09:47:16 PM
hmm, care to share it? lol

anyway, does your limit decrease on a kick chasingsol?
Title:
Post by: chasingsol on March 29, 2006, 03:45:53 AM
Hi Tom,

Yes, it does decrease on a kick. If you'd like to pm me your e-mail, I can send you the modified version. I won't post it here out of respect to Rob. Also, since you have contacted him regarding needed bug fixes, I don't want to tie myself in to being tech support for a module I didn't write!

Cheers,

Mark.
Title:
Post by: Tom65789 on April 01, 2006, 07:11:42 PM
ok must be something with our network then lol, our kick dont work right but i can fix it, i have also contacted you :D
Title:
Post by: chasingsol on April 10, 2006, 09:09:51 PM
One thing I have noticed, the buffer doesn't seem to stay stable after extended periods of running. I have it set for a 6 user variance in a channel, and it's now limiting at 9. Deleting the limit from that channel and reapplying it does not change this behavior.

Any word on the fixes yet Tom?
Title:
Post by: Tom65789 on April 11, 2006, 03:11:57 PM
i dont but mine has been working fine, maybe try a unedited version of it. i also edited my own so now it works in channels that arent registered too.

Have your Services split or have any of the servers?
Title:
Post by: chasingsol on April 20, 2006, 04:05:27 AM
Services has split once since using this module.. Ping timeout, which would imply a lockup. No core file, didn't crash. Unknown if it's related.

Only thing of any use was the current process state "T":

Code: [Select]
ircd     14777  0.0  1.0 17784 10792 ?       T    Mar25  20:02 ./services

Noticed that 0.6 is our modified version, flattered to say the least!

Rob, any update on bug fixes? The database weirdness one is the most annoying, and some limit drift occurs after a long period of use. The drift is always upward, allowing a larger limit difference than defined (other than the +1 required anyway). Perhaps an internal Anope issue?
Title:
Post by: Dave Robson on April 20, 2006, 07:52:56 AM
The database loading should have been fixed ages ago and is on whatever version is the latest on the modules web page.
Title:
Post by: chasingsol on April 21, 2006, 02:02:32 AM
Hi Rob,

Thanks for the response. The database corruption issue is not resolved as of version 0.6. For some reason, it loses trailing 0's (possibly any trailing character).

For example, a database entry of:

#p2p-irc.net 6 60

becomes

#p2p-irc.net 6 6

This occurs on a module reload or on a services restart. Does not occur during normal runtime.

Cheers,

Mark.

[Edited on 4-21-2006 by chasingsol]
Title:
Post by: Tom65789 on April 21, 2006, 08:00:17 PM
im sure that was fixed. my databases seem fine even after restart and reload
Title:
Post by: chasingsol on April 21, 2006, 09:09:44 PM
I'll check it out again. It's entirely possible I was being dense and didn't do "make clean" before doing "make modules"... wouldn't be the first time.
Title:
Post by: Tom65789 on April 21, 2006, 10:42:27 PM
lol but it works on my IRCd
Title:
Post by: chasingsol on April 22, 2006, 02:14:54 AM
Sure enough, I was obviously having a "brain lapse". Only issue I see remaining is the "drift". Otherwise, works great.

Thank you Tom for commissioning this module and Rob for writing it!
Title:
Post by: Tom65789 on April 22, 2006, 04:01:30 PM
np lol. but Rob pwns all :D
Title:
Post by: chasingsol on April 22, 2006, 07:09:52 PM
If anyone is interested in a patch that makes the module honor the time limit on part/quit/kick as well, you can download it here:

http://www.p2p-irc.net/downloads/cs_limit.diff

This comes with no warranties, yadda yadda. If it makes your services keel over and die, you were warned.

To patch cs_limit.c, download the above file to the same folder as cs_limit.c and do:

Code: [Select]
patch cs_limit.c < cs_limit.diff
Title:
Post by: Tom65789 on April 23, 2006, 09:02:27 PM
mmmk i did make an alernative solution too which i believe is better but i have no idea how stable it is but its been running for many weeks just fine with no downtime on my server. what my version does is it has an extra config option called CSLimitTimeout2 10 and what this does is it acts like the CSLimitDefaultTimeout 60 like it changes the limit after 60 seconds or whatever value its changed to except CSLimitTimeout2 acts on quits parts and kicks where as CSLimitDefaultTimeout is for joins so the values can be different. and i am still looking how to make it limit channels that are not registered but i think i know how i can do this but it would only be a tempory limit because when the user leaves it removes the limit and thats it.

[Edited on 23-4-2006 by Tom65789]
Title:
Post by: razr on October 25, 2006, 12:20:37 AM
anyon got a working link to this module
Title:
Post by: Jobe on October 25, 2006, 01:49:13 AM
Try on http://modules.anope.org
Title:
Post by: razr on October 25, 2006, 01:51:21 AM
nope not there
Title:
Post by: Tom65789 on October 25, 2006, 07:54:54 AM
http://www.anope.org/modules/ <<< still on there and works...
Title:
Post by: n00bie on October 25, 2006, 08:55:32 AM
I'f i'm not mistaken, there is two type of channel limiting modules. cs_chanlimit by Trystan and cs_limit by Rob. The cs_limit module (which i currently used, and works on 1.7.17 too) by Rob can be found from the old modules site but i'm not sure about cs_chanlimit :p

[Edited on 25-10-2006 by n00bie]