This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Error: too many open files

Help for those learning Tcl or writing their own scripts.
Post Reply
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Error: too many open files

Post by cannot_delete »

Hi,

I get the following errors all the time:
14/08/07@05:03.21> : couldn't execute "/usr/bin/ncftpput": too many open files
while executing
"exec /usr/bin/ncftpput -V -a -m -f /home/eggdrop/moxquiz/scripts/ftpserver.ftp /logs/timestats/ ~/$webscore"
(procedure "mx_userspeedsave" line 368)
invoked from within
"mx_userspeedsave"
(procedure "moxquiz_pubm" line 656)
invoked from within
"moxquiz_pubm $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"


14/08/07@05:03.27> : couldn't execute "/usr/bin/ncftpput": too many open files
while executing
"exec /usr/bin/ncftpput -V -a -m -f /home/eggdrop/moxquiz/scripts/ftpserver.ftp / ~/mox.html"
(procedure "mx_html" line 118)
invoked from within
"mx_html $newnick $host $handle $channel"
(procedure "moxquiz_on_nickchanged" line 10)
invoked from within
"moxquiz_on_nickchanged $_stnm1 $_stnm2 $_stnm3 $_stnm4 $_stnm5"


14/08/07@05:05.44> : couldn't execute "/usr/bin/ncftpput": too many open files
while executing
"exec /usr/bin/ncftpput -V -a -m -f /home/eggdrop/moxquiz/scripts/ftpserver.ftp / ~/mox.html"
(procedure "mx_html" line 118)
invoked from within
"mx_html $botnick "" "" $quizconf(quizchannel)"
(procedure "moxquiz_after_part" line 3)
invoked from within
"moxquiz_after_part"


14/08/07@05:05.45> : couldn't execute "/usr/bin/ncftpput": too many open files
while executing
"exec /usr/bin/ncftpput -V -a -m -f /home/eggdrop/moxquiz/scripts/ftpserver.ftp / ~/mox.html"
(procedure "mx_html" line 118)
invoked from within
"mx_html $botnick "" "" $quizconf(quizchannel)"
(procedure "moxquiz_after_part" line 3)
invoked from within
"moxquiz_after_part"

.
.
.

14/08/07@11:10.29> : moxquiz.mo.funpic.de: unknown host.
ncftpput: cannot open moxquiz.mo.funpic.de: unknown host.
while executing
"exec /usr/bin/ncftpput -V -a -m -f /home/eggdrop/moxquiz/scripts/ftpserver.ftp / ~/mox.html"
(procedure "mx_html" line 118)
invoked from within
"mx_html $botnick "" "" $quizconf(quizchannel)"
(procedure "moxquiz_after_part" line 3)
invoked from within
"moxquiz_after_part"
too many open files
The error occurs on random locations in the script. Unfortunately I can't find a file in the script that isn't closed after use. Reducing the files being opened doesn't seem to help. Is there a way to avoid the bot freezing due to this error other than restarting it all the time?

moxquiz.mo.funpic.de: unknown host.
this one is probably easier: how can I avoid to send a file to my webspace (per ftp) which ist temporarily down?


I hope my questions aren't too unspecific. If needed, here's the script: http://moxquiz.mo.funpic.de/test/moxquizz.txt


Thanks for your help!

-typ-
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I had a quick look at the script, it seems to properly close every file it opens. I guess the problem is from the machine hosting your Eggdrop.
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

Thanks!


I consulted the bot-hoster, who told me the problem lies within the script. Is there a way to convince him of the opposite?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

-typ- wrote:Thanks!


I consulted the bot-hoster, who told me the problem lies within the script. Is there a way to convince him of the opposite?
Unload all scripts; test one by one to see for certain which is the offender.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

I know the error lies within: http://moxquiz.mo.funpic.de/test/moxquizz.txt
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

I guess one option might be to replace the open and close-commands with a proc featuring some debugging code; ie, rename open to _open, create a proc named open that calls _open, and tries to figure out number of opened files, where it was called from, and such.

Also, remember that sockets also make use of file descriptors, including the http-package..
Not sure this part might be to blame, but might be worth investigating:

Code: Select all

variable newquest ""
package require http
setudef flag weather
set agent "Mozilla/4.75 (X11; U; Linux 2.2.17; i586; Nav)"

bind pub - !qread pub_w
bind pub - !qinsert pub_i
bind pub - !qcorrect pub_c

proc pub_w {nick uhand handle chan input} {
    global botnick agent datadir newquest
 
if {![isop $nick $chan]} {
mxirc_notc $nick "Du musst Op sein, um diese Funktion auszuführen"
return
}
mxirc_quick_notc $nick "Neue Fragen werden eingelesen. Sollte der Befehl nicht funktionieren, probier zunächst !rehash."


    set query "http://moxquiz.mo.funpic.de/fragen/neue_fragen.txt"
    set http [::http::config -useragent $agent]
    set http [::http::geturl $query]
    set html [::http::data $http]

 set questtime "[unixtime].txt"
 set fname "$datadir/backup/$questtime"
 set newquest $fname
 set fp [open $fname "a"]

foreach line [split $html "\n"] {
puts $fp $line
}

close $fp
NML_375
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

thx, I'll change my hoster and try that.
Post Reply