From: "Gerardo Santana Gómez Garrido" Date: 2008-03-06T10:03:48+09:00 Subject: Re: Too many open files on OpenBSD Hello Edd, an OpenBSD user here too. The error messages speaks of more than 3055 recursion levels. Not every level is a call to parse, but if you take out the #new and #each methods I'm sure there are a lot more than just 5 files opened at the same time. Are there that many dependencies? I don't think so. I haven't seen those .tlpsrc files yet. I'll take a look. On 3/5/08, Edd Barrett wrote: > Edd Barrett wrote: > > ---8<--- > > ./tlpsrcnode.rb:19:in `initialize': Too many open files - > > /home/tl/tl/Master/tlpkg/tlpsrc/wordcount.tlpsrc (Errno::EMFILE) > > from ./tlpsrcnode.rb:19:in `new' > > from ./tlpsrcnode.rb:19:in `parse' > > from ./tlpsrcnode.rb:30:in `parse' > > from ./tlpsrcnode.rb:20:in `each' > > from ./tlpsrcnode.rb:20:in `parse' > > from ./tlpsrcnode.rb:30:in `parse' > > from ./tlpsrcnode.rb:20:in `each' > > from ./tlpsrcnode.rb:20:in `parse' > > ... 3055 levels... > > from ./tlpsrcnode.rb:20:in `each' > > from ./tlpsrcnode.rb:20:in `parse' > > from ./roottlpsrcnode.rb:53:in `startParse' > > from ./rbmfsplit:54 > > ---8<--- > > > > This appears to happen after 297 files are concurrently opened. > > Sorry this statement is inaccurate. > > 297 files have previously been opened and after each one has been parsed > is immediately closed. > > The call stack should be an indication of concurrently opened files? In > this case 5 files. (Its recursive). > > i suppose the src of the parse function helps (probably disobeying all > coding conventions, sorry): > ---8<--- > def parse() > fileHandle = File.new @path > for line in fileHandle do > > line =~ /^(.*?) (.*)/ > cmd = $~[1] > arg = $~[2] > > if cmd =~ /^#.*/ then > nil # comment > elsif cmd == "depend" then > newNode = TlpSrcNode.new @basePath + arg + ".tlpsrc", @rootNode > newNode.parse # and so recursion starts > @rootNode.incrementDeps > elsif cmd == "runpattern" then > @rootNode.addRunFile arg > elsif cmd == "docpattern" then > @rootNode.addDocFile arg > elsif cmd == "srcpattern" then > @rootNode.addSrcFile arg > elsif @nothingCmds.detect { |i| i == cmd } then > nil # OK > elsif @todoCmds.detect { |i| i == cmd } then > nil # XXX work out what these are > else > puts "*error: unknown cmd: '#{cmd}' arg='#{arg}'" > exit 1 > end > end > > fileHandle.close > end > ---8<--- > -- > Posted via http://www.ruby-forum.com/. > > -- Gerardo Santana