Narendra Prasad Madanapalli
2011-Aug-21 11:38 UTC
[syslinux] TFTPD: Cannot open /etc/hosts.{allow, deny}: Too many open files
Hi, I have been running TFTPD server for 3 weeks and performed about 100 deployments. After that, TFTPD started throwing the follwing errotrs in /var/log/messages Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: warning: cannot open /etc/hosts.allow: Too many open files Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: warning: cannot open /etc/hosts.deny: Too many open files Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: connection refused from 0.0.0.0 Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: warning: cannot open /etc/hosts.allow: Too many open files Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: warning: cannot open /etc/hosts.deny: Too many open files Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: connection refused from 0.0.0.0 Here is the output of lsof -p 20782 -l COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME tftpd 20782 0 cwd DIR 253,0 4096 13205505 /opt/tftpboot tftpd 20782 0 rtd DIR 253,0 4096 2 / tftpd 20782 0 txt REG 253,0 27984 32871493 /opt/tftp/sbin/tftpd tftpd 20782 0 mem REG 253,0 125736 20841853 /lib/ ld-2.5.so tftpd 20782 0 mem REG 253,0 1602128 20841854 /lib/ libc-2.5.so tftpd 20782 0 mem REG 253,0 32856 54860420 /usr/lib/libwrap.so.0.7.6 tftpd 20782 0 mem REG 253,0 101404 20841866 /lib/ libnsl-2.5.so tftpd 20782 0 mem REG 253,0 46680 20840489 /lib/ libnss_files-2.5.so tftpd 20782 0 0u CHR 1,3 1574 /dev/null tftpd 20782 0 1u CHR 1,3 1574 /dev/null tftpd 20782 0 2u CHR 1,3 1574 /dev/null tftpd 20782 0 3u unix 0xf73a2ac0 2943680 socket tftpd 20782 0 4u IPv4 2943683 UDP *:tftp tftpd 20782 0 5u sock 0,5 2945126 can't identify protocol tftpd 20782 0 6u sock 0,5 2946157 can't identify protocol tftpd 20782 0 7u sock 0,5 2947174 can't identify protocol tftpd 20782 0 8u sock 0,5 2952758 can't identify protocol tftpd 20782 0 9u sock 0,5 2953809 can't identify protocol tftpd 20782 0 10u sock 0,5 2959221 can't identify protocol tftpd 20782 0 11u sock 0,5 2965427 can't identify protocol tftpd 20782 0 12u sock 0,5 2968500 can't identify protocol ....... ...... tftpd 20782 0 1019u sock 0,5 4833123 can't identify protocol tftpd 20782 0 1020u sock 0,5 4839162 can't identify protocol tftpd 20782 0 1021u sock 0,5 4840216 can't identify protocol tftpd 20782 0 1022u sock 0,5 4841243 can't identify protocol tftpd 20782 0 1023u sock 0,5 4842249 can't identify protocol And the output of limits # cat /proc/sys/fs/file-max 754278 # cat /proc/sys/fs/file-nr 2496 0 754278 # ulimit -n 1024 I am not sure why TFTPD is not closing all opened sockets. I noticed in the file tftp-hpa-5.0/tftpd/tftpd.c around line 906 it opens a socket and there is no corresponding close() statemnt for that. Any help on this would be highly appreciated? Thanks, Narendra.
Lee Eric
2011-Aug-21 14:20 UTC
[syslinux] TFTPD: Cannot open /etc/hosts.{allow, deny}: Too many open files
Hey mate, you may need to have a look at /etc/xinetd.d/tftp and try to modify cps parameter. Your problem may caused by too may connections at the same time with tftp daemon. You can increase the first value to 200 and the second value you can set up to 1. That means max "200" simultaneous connections to any one service. if 200 is reached, back off for "1" sec. Regards, Eric On Sun, Aug 21, 2011 at 7:38 PM, Narendra Prasad Madanapalli <narendramind at gmail.com> wrote:> Hi, > > I have been running TFTPD server for 3 weeks and performed about 100 > deployments. After that, TFTPD started throwing the follwing errotrs in > /var/log/messages > > Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: warning: cannot open > /etc/hosts.allow: Too many open files > Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: warning: cannot open > /etc/hosts.deny: Too many open files > Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: connection refused from 0.0.0.0 > Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: warning: cannot open > /etc/hosts.allow: Too many open files > Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: warning: cannot open > /etc/hosts.deny: Too many open files > Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: connection refused from 0.0.0.0 > > Here is the output of lsof -p 20782 -l > > COMMAND ? PID ? ? USER ? FD ? TYPE ? ? DEVICE ? ?SIZE ? ? NODE NAME > tftpd ? 20782 ? ? ? ?0 ?cwd ? ?DIR ? ? ?253,0 ? ?4096 13205505 /opt/tftpboot > tftpd ? 20782 ? ? ? ?0 ?rtd ? ?DIR ? ? ?253,0 ? ?4096 ? ? ? ?2 / > tftpd ? 20782 ? ? ? ?0 ?txt ? ?REG ? ? ?253,0 ? 27984 32871493 > /opt/tftp/sbin/tftpd > tftpd ? 20782 ? ? ? ?0 ?mem ? ?REG ? ? ?253,0 ?125736 20841853 /lib/ > ld-2.5.so > tftpd ? 20782 ? ? ? ?0 ?mem ? ?REG ? ? ?253,0 1602128 20841854 /lib/ > libc-2.5.so > tftpd ? 20782 ? ? ? ?0 ?mem ? ?REG ? ? ?253,0 ? 32856 54860420 > /usr/lib/libwrap.so.0.7.6 > tftpd ? 20782 ? ? ? ?0 ?mem ? ?REG ? ? ?253,0 ?101404 20841866 /lib/ > libnsl-2.5.so > tftpd ? 20782 ? ? ? ?0 ?mem ? ?REG ? ? ?253,0 ? 46680 20840489 /lib/ > libnss_files-2.5.so > tftpd ? 20782 ? ? ? ?0 ? ?0u ? CHR ? ? ? ?1,3 ? ? ? ? ? ? 1574 /dev/null > tftpd ? 20782 ? ? ? ?0 ? ?1u ? CHR ? ? ? ?1,3 ? ? ? ? ? ? 1574 /dev/null > tftpd ? 20782 ? ? ? ?0 ? ?2u ? CHR ? ? ? ?1,3 ? ? ? ? ? ? 1574 /dev/null > tftpd ? 20782 ? ? ? ?0 ? ?3u ?unix 0xf73a2ac0 ? ? ? ? ?2943680 socket > tftpd ? 20782 ? ? ? ?0 ? ?4u ?IPv4 ? ?2943683 ? ? ? ? ? ? ?UDP *:tftp > tftpd ? 20782 ? ? ? ?0 ? ?5u ?sock ? ? ? ?0,5 ? ? ? ? ?2945126 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? ?6u ?sock ? ? ? ?0,5 ? ? ? ? ?2946157 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? ?7u ?sock ? ? ? ?0,5 ? ? ? ? ?2947174 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? ?8u ?sock ? ? ? ?0,5 ? ? ? ? ?2952758 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? ?9u ?sock ? ? ? ?0,5 ? ? ? ? ?2953809 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? 10u ?sock ? ? ? ?0,5 ? ? ? ? ?2959221 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? 11u ?sock ? ? ? ?0,5 ? ? ? ? ?2965427 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 ? 12u ?sock ? ? ? ?0,5 ? ? ? ? ?2968500 can't > identify protocol > ....... > ...... > tftpd ? 20782 ? ? ? ?0 1019u ?sock ? ? ? ?0,5 ? ? ? ? ?4833123 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 1020u ?sock ? ? ? ?0,5 ? ? ? ? ?4839162 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 1021u ?sock ? ? ? ?0,5 ? ? ? ? ?4840216 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 1022u ?sock ? ? ? ?0,5 ? ? ? ? ?4841243 can't > identify protocol > tftpd ? 20782 ? ? ? ?0 1023u ?sock ? ? ? ?0,5 ? ? ? ? ?4842249 can't > identify protocol > > > And the output of limits > > # cat /proc/sys/fs/file-max > 754278 > > # cat /proc/sys/fs/file-nr > 2496 ? ?0 ? ? ? 754278 > > # ulimit -n > 1024 > > > I am not sure why TFTPD is not closing all opened sockets. > > I noticed in the file tftp-hpa-5.0/tftpd/tftpd.c around line 906 it opens a > socket and there is no corresponding close() statemnt for that. > > > > Any help on this would be highly appreciated? > > > Thanks, > Narendra. > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux > Please do not send private replies to mailing list traffic. > >
Narendra Prasad Madanapalli
2011-Aug-22 04:17 UTC
[syslinux] TFTPD: Cannot open /etc/hosts.{allow, deny}: Too many open files
Thanks Eric for your response. I am running TFTP as normal daemon but not xinetd daemon. I noticed 1024 file descriptors are still opened even after all my deployments (150+) are complete. In ideal case, FD for corresponding request should be closed once the request is serviced. Here again I am pasting the various log messages and limits in my system: /var/log/messages Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: warning: cannot open /etc/hosts.allow: Too many open files Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: warning: cannot open /etc/hosts.deny: Too many open files Aug 20 21:52:55 RTP-OSP-Server tftpd[7146]: connection refused from 0.0.0.0 Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: warning: cannot open /etc/hosts.allow: Too many open files Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: warning: cannot open /etc/hosts.deny: Too many open files Aug 20 21:52:57 RTP-OSP-Server tftpd[7147]: connection refused from 0.0.0.0 Here is the output of lsof -p 20782 -l COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME tftpd 20782 0 cwd DIR 253,0 4096 13205505 /opt/tftpboot tftpd 20782 0 rtd DIR 253,0 4096 2 / tftpd 20782 0 txt REG 253,0 27984 32871493 /opt/tftp/sbin/tftpd tftpd 20782 0 mem REG 253,0 125736 20841853 /lib/ld-2.5.so tftpd 20782 0 mem REG 253,0 1602128 20841854 /lib/libc-2.5.so tftpd 20782 0 mem REG 253,0 32856 54860420 /usr/lib/libwrap.so.0.7.6 tftpd 20782 0 mem REG 253,0 101404 20841866 /lib/libnsl-2.5.so tftpd 20782 0 mem REG 253,0 46680 20840489 /lib/libnss_files-2.5.so tftpd 20782 0 0u CHR 1,3 1574 /dev/null tftpd 20782 0 1u CHR 1,3 1574 /dev/null tftpd 20782 0 2u CHR 1,3 1574 /dev/null tftpd 20782 0 3u unix 0xf73a2ac0 2943680 socket tftpd 20782 0 4u IPv4 2943683 UDP *:tftp tftpd 20782 0 5u sock 0,5 2945126 can't identify protocol tftpd 20782 0 6u sock 0,5 2946157 can't identify protocol tftpd 20782 0 7u sock 0,5 2947174 can't identify protocol tftpd 20782 0 8u sock 0,5 2952758 can't identify protocol tftpd 20782 0 9u sock 0,5 2953809 can't identify protocol tftpd 20782 0 10u sock 0,5 2959221 can't identify protocol tftpd 20782 0 11u sock 0,5 2965427 can't identify protocol tftpd 20782 0 12u sock 0,5 2968500 can't identify protocol ....... tftpd 20782 0 1019u sock 0,5 4833123 can't identify protocol tftpd 20782 0 1020u sock 0,5 4839162 can't identify protocol tftpd 20782 0 1021u sock 0,5 4840216 can't identify protocol tftpd 20782 0 1022u sock 0,5 4841243 can't identify protocol tftpd 20782 0 1023u sock 0,5 4842249 can't identify protocol And the output of limits # cat /proc/sys/fs/file-max 754278 # cat /proc/sys/fs/file-nr 2496 0 754278 # ulimit -n 1024> Hey mate, > > you may need to have a look at /etc/xinetd.d/tftp and try to modify > cps parameter. Your problem may caused by too may connections at the > same time with tftp daemon. You can increase the first value to 200 > and the second value you can set up to 1. That means max "200" > simultaneous connections to any one service. if 200 is reached, back > off for "1" sec. > > Regards, > > Eric