egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

files not closing

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ShavdApe
Halfop


Joined: 15 Dec 2003
Posts: 46

PostPosted: Fri Mar 20, 2009 2:58 pm    Post subject: files not closing Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Mar 20, 2009 5:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
ShavdApe
Halfop


Joined: 15 Dec 2003
Posts: 46

PostPosted: Fri Mar 20, 2009 6:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Mar 20, 2009 6:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
ShavdApe
Halfop


Joined: 15 Dec 2003
Posts: 46

PostPosted: Fri Mar 20, 2009 6:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Mar 20, 2009 10:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber