initconf never closes the ircd.conf file descriptor

I've been using my own modification of bahamut (solid-ircd) for a while now, and a user pointed out an issue to us, that applies to bahamut as well (1.8.6) included. The issue is that initconf never closes the ircd.conf file descriptor, so its essentially a memory leak as well. I checked out the latest bahamut via git-clone to test it out, and make the patch that's attached on this email. IRCd started under PID 31402 linux-cx9m:/home/jason # lsof -p 31402 | grep "ircd.conf" No file descriptors are open. So I sent out a SIGHUP. linux-cx9m:/home/jason # kill -HUP 31402 linux-cx9m:/home/jason # lsof -p 31402 | grep "ircd.conf" ircd 31402 jason 7r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf Let's send out 11 mores just for kicks. linux-cx9m:/home/jason # lsof -p 31402 | grep "ircd.conf" ircd 31402 jason 7r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 8r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 9r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 10r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 11r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 12r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 13r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 14r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 15r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 16r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 17r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf ircd 31402 jason 18r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf linux-cx9m:/home/jason # ls -l /proc/31402/fd | grep "ircd.conf" | wc -l 12 This is a pretty easy fix, attach is a patch that fixes this. With the patch applied: linux-cx9m:/home/jason # kill -HUP 31761 linux-cx9m:/home/jason # kill -HUP 31761 linux-cx9m:/home/jason # kill -HUP 31761 linux-cx9m:/home/jason # lsof -p 31761 | grep "ircd.conf" No file descriptors are open. I don't see this being a "big issue," since flock is never called and the file is only open for reading. We've done quite a few rehashes ourselves and never really noticed this issue until it was pointed out. [root@vortex ~]# ls -l /proc/5047/fd | grep "ircd.conf" | wc -l 21 - Server Up 632 days, 2:30:22 End of /STATS report. - I seriously doubt that anyone will keep rehashing the ircd until the maximum number of file descriptors is reached. Can anyone else confirm this issue on their server(s)? Juan Baez

Thanks Juan! If you can provide a git formatted patch in full, it will let me properly attribute the change to you. If you don't care, then I will apply this as is! -epi On Fri, Jun 26, 2009 at 12:13 PM, Juan Baez<tux@solid-ircd.com> wrote:
I’ve been using my own modification of bahamut (solid-ircd) for a while now, and a user pointed out an issue to us, that applies to bahamut as well (1.8.6) included.
The issue is that initconf never closes the ircd.conf file descriptor, so its essentially a memory leak as well.
I checked out the latest bahamut via git-clone to test it out, and make the patch that’s attached on this email.
IRCd started under PID 31402
linux-cx9m:/home/jason # lsof -p 31402 | grep "ircd.conf"
No file descriptors are open. So I sent out a SIGHUP.
linux-cx9m:/home/jason # kill -HUP 31402
linux-cx9m:/home/jason # lsof -p 31402 | grep "ircd.conf"
ircd 31402 jason 7r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
Let’s send out 11 mores just for kicks.
linux-cx9m:/home/jason # lsof -p 31402 | grep "ircd.conf"
ircd 31402 jason 7r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 8r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 9r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 10r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 11r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 12r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 13r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 14r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 15r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 16r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 17r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
ircd 31402 jason 18r REG 8,3 4636 66269 /home/jason/ircd/ircd.conf
linux-cx9m:/home/jason # ls -l /proc/31402/fd | grep "ircd.conf" | wc -l
12
This is a pretty easy fix, attach is a patch that fixes this. With the patch applied:
linux-cx9m:/home/jason # kill -HUP 31761
linux-cx9m:/home/jason # kill -HUP 31761
linux-cx9m:/home/jason # kill -HUP 31761
linux-cx9m:/home/jason # lsof -p 31761 | grep "ircd.conf"
No file descriptors are open. I don’t see this being a “big issue,” since flock is never called and the file is only open for reading.
We’ve done quite a few rehashes ourselves and never really noticed this issue until it was pointed out.
[root@vortex ~]# ls -l /proc/5047/fd | grep "ircd.conf" | wc -l
21
-
Server Up 632 days, 2:30:22
End of /STATS report.
-
I seriously doubt that anyone will keep rehashing the ircd until the maximum number of file descriptors is reached.
Can anyone else confirm this issue on their server(s)?
Juan Baez
_______________________________________________ DALnet-src mailing list DALnet-src@lists.dal.net https://lists.dal.net/mailman/listinfo/dalnet-src
participants (2)
-
Aaron Wiebe
-
Juan Baez