View Issue Details

IDProjectCategoryView StatusLast Update
0003238unrealircdpublic2007-02-16 08:18
ReporterMr_SmokeAssigned Tosyzop 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platformi686, x86_64OSLinuxOS Version2.4.27, 2.6.18
Product Version3.2.6 
Target VersionFixed in Version3.2.6 
Summary0003238: rehash causes ircd to open new fd for modules
DescriptionAt each rehash, ircd re-opens each module, causing the number of open files to increase and eventually reach whatever limit was set (1024 here), causing the ircd to refuse any further connections.
Steps To ReproduceRehash a running server
Additional InformationReproduced on 4 different ircd's. Two on a 2.6.18 x86_64, one on a 2.4.27 i686, and one on a 2.6.10 i686.
TagsNo tags attached.
3rd party modules

Activities

djGrrr

2007-02-16 05:35

reporter   ~0013220

hmm, so if you rehash a LOT of times it will eventually reach the limit ?

Mr_Smoke

2007-02-16 05:49

reporter   ~0013221

Yeah, a lot. I came across an ircd that had rehashed 507 times. This network wanted a list of active channels in the motd updated every hour.
Yes. Hourly rehash. Yuck.

djGrrr

2007-02-16 06:37

reporter   ~0013222

lol, well, they should use /rehash -motd to do it, but thats besides the point, this is definetly a big issue

Grunt

2007-02-16 07:09

reporter   ~0013223

Last edited: 2007-02-16 07:10

Does "/rehash -motd" reload all modules? I don't think so.

Edit: I didn't see the post above...

syzop

2007-02-16 08:01

administrator   ~0013224

Strange nobody noticed this before, but I can confirm it on my machine.
The odd thing is I've heard of people that rehash their ircd every 5 minutes (yeah crazy cronjob), hmm :P.
Perhaps this is new in 3.2.6?

Mr_Smoke

2007-02-16 08:04

reporter   ~0013225

Definitely agree that "/rehash -motd" should be used instead. However in this particular case, rehash was achieved via kill -HUP, since it was a cron job.

syzop

2007-02-16 08:04

administrator   ~0013226

int file_exists(char* file)
{
    FILE *fd;
    fd = fopen(file, "r");
    if (!fd)
    {
        return 0;
    }
    return 1;
}

AHEM *cough*

syzop

2007-02-16 08:18

administrator   ~0013227

Fixed in CVS (32* and 33*):
- Fixed file descriptor leakage on rehash. This resulted in [number of modules loaded]
  file descriptors being leaked upon every /REHASH.
  So if you, for example, had 3 modules loaded and rehashed 30 times, it would cause
  the ircd to consume 90 useless file descriptors (which often means 90 less file
  descriptors being available to clients).

Patch here:
http://www.vulnscan.org/tmp/fd.leak.unreal326.patch

Was indeed 3.2.6 only, cause was:
"- loadmodule now reports proper errors when the actual file can't be found, instead of blaming
  it on the temp file, reported in 0003015.
(aquanight backport)"

Issue History

Date Modified Username Field Change
2007-02-16 04:21 Mr_Smoke New Issue
2007-02-16 05:35 djGrrr Note Added: 0013220
2007-02-16 05:49 Mr_Smoke Note Added: 0013221
2007-02-16 06:37 djGrrr Note Added: 0013222
2007-02-16 07:09 Grunt Note Added: 0013223
2007-02-16 07:10 Grunt Note Edited: 0013223
2007-02-16 07:57 syzop Status new => confirmed
2007-02-16 08:01 syzop Note Added: 0013224
2007-02-16 08:04 Mr_Smoke Note Added: 0013225
2007-02-16 08:04 syzop Note Added: 0013226
2007-02-16 08:18 syzop Status confirmed => resolved
2007-02-16 08:18 syzop Fixed in Version => 3.2.6
2007-02-16 08:18 syzop Resolution open => fixed
2007-02-16 08:18 syzop Assigned To => syzop
2007-02-16 08:18 syzop Note Added: 0013227