| View previous topic :: View next topic |
| Author |
Message |
ShavdApe Halfop
Joined: 15 Dec 2003 Posts: 46
|
Posted: Fri Mar 20, 2009 2:58 pm Post subject: files not closing |
|
|
Having problems with my eggdrops not closing files to the point that they end up reaching the maximum allowed currently set at 1024
using pretty much this code
set found 0
set fs [open $db r]
while {![eof $fs]} {
gets $fs line
if {$line == $word} {
set found 1
}
}
close $fs
if {!$found} {
set wfile [open $db a]
puts $wfile $word
close $wfile
putquick "PRIVMSG .....
}
Did I do something wrong ? Or should I just find another way? _________________ Driving lessons bolton |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Mar 20, 2009 5:46 pm Post subject: |
|
|
That code looks perfectly fine, I see one { missing in the beginning, but I guess that's just the proc-head.
Could you add something like this at the end of the proc?
| Code: | | putlog "Files opened: [file channels]" |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
ShavdApe Halfop
Joined: 15 Dec 2003 Posts: 46
|
Posted: Fri Mar 20, 2009 6:07 pm Post subject: |
|
|
Ok heres what happened in a few minutes
Files opened: stdin stdout stderr
Files opened: file17 stdin file18 stdout file20 file19 stderr file16
Files opened: file22 file17 stdin file18 stdout file20 file19 stderr file21 file16
Files opened: stdin file17 stdout file18 stderr file19 file20 file21 file22 file23 file24 file25 file26 file27 file28 file30 file29 file16
Files opened: file35 stdin file17 stdout file18 stderr file19 file20 file21 file22 file23 file24 file25 file26 file27 file28 file30 file29 file31 file32 file33 file34 file16
You can see how this will quicly become a problem _________________ Driving lessons bolton |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Mar 20, 2009 6:44 pm Post subject: |
|
|
Indeed!
What strikes me, however, is that the number of opened files increases by more than 2 for each invocation.. And especially that the number of opened files increases in a non-linear way.
Since you only open the file twice, this suggests that there is some other script in play here that does not clean up file handles properly. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
ShavdApe Halfop
Joined: 15 Dec 2003 Posts: 46
|
Posted: Fri Mar 20, 2009 6:59 pm Post subject: |
|
|
There is more than one process opening and supposedly closing files but it doesnt appear to do so I have made sure that all the processes call the files by different names so as not to get them confused in any way but nothing I do seems to fix this problem
I have tried just the one process so as to be sure and still I end up with this problem. _________________ Driving lessons bolton |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri Mar 20, 2009 10:32 pm Post subject: |
|
|
Best advice I can give you right now, is to remove all scripts, and then load them one at a time until the issue returns. That, atleast, should tell you which script is at fault.
Next step would then be to add some putlog's whenever you open or close a file in a script, to keep track of which files are left opened, and where.. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|