[oe] Problem building kernel - too many files open

Khem Raj raj.khem at gmail.com
Thu Mar 12 19:57:24 UTC 2009


On Thursday 12 March 2009 06:14:34 Jader wrote:
> Hello.
> I had the same problem. It's inside classes/kernel.bbclass:298
> (reproduced below):
>
>
> python populate_packages_prepend () {
> 	def extract_modinfo(file):
> 		import tempfile, os, re
> 		tempfile.tempdir = bb.data.getVar("WORKDIR", d, 1)
> 		tmpfile = tempfile.mkstemp()[1]
> 		cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" %
> (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "",
> file, tmpfile) os.system(cmd)
> 		f = open(tmpfile)
> 		l = f.read().split("\000")
> 		f.close()
> 		os.unlink(tmpfile)
>
>
> tempfile.mkstemp() is used to create a temporary file. This function
> return a tuple with an OS file descriptor and a filename. Filename is
> stored in "tmpfile" but descriptor is not stored anywhere, but it is
> still open because it's only an integer to python so it is not closed at
> the end of the function.
>
> For each iteration in which this function is called, a new OS file
> descriptor is opened, but not closed. The solution is to store the file
> descriptor and close it:

How about using TemporaryFile () to create the file instead of mkstemp ?
we do not have to worry about cleaning it up once it is closed. 

>
>
> python populate_packages_prepend () {
> 	def extract_modinfo(file):
> 		import tempfile, os, re
> 		tempfile.tempdir = bb.data.getVar("WORKDIR", d, 1)
> 		tf = tempfile.mkstemp()
> 		tmpfile = tf[1]
> 		cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" %
> (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "",
> file, tmpfile) os.system(cmd)
> 		f = open(tmpfile)
> 		l = f.read().split("\000")
> 		f.close()
> 		os.close(tf[0])
> 		os.unlink(tmpfile)
>
>
> There's a patch attached. As Iḿ new to git, I don know it it was created
> in the right way. Used command following:
>
>
> git format-patch cab70860b89f0fd856c5de1c37c6a3d31fd3cc9d --stdout classes
> >kernel.bbclass.patch
>
>
> Jader H. Silva
> 2MI Tecnologia
>
> Em Qui, 2009-03-12 às 09:51 +0100, Petr Štetiar escreveu:
> > Marco Cavallini <koansoftware at gmail.com> [2009-03-12 09:02:08]:
> > > Piero Pezzin ha scritto:
> >
> > [...]
> >
> > > >>> During kernel building, I got the following error:
> > > >>>
> > > >>> OTE: package linux-2.6.28: started
> > > >>> NOTE: package linux-2.6.28-r6: task do_package: started
> > > >>> ERROR: Error in executing:
> > > >>> /home/piero/work/qong-nobk/openembedded/openembedded/packages/linux
> > > >>>/ linux_2.6.28.bb
> > > >>> ERROR: Exception:exceptions.IOError Message:[Errno 24] Too many
> > > >>> open
> > > >>
> > > >> files:
> > >
> > > this is a known error.
> > > Nobody solved it yet.
> >
> > Maybe, that increasing the numbers of max. file handles and number of
> > max. inodes might help you:
> >
> > /proc/sys/fs/file-max
> > /proc/sys/fs/inode-max
> >
> > -- ynezz
> >
> > _______________________________________________
> > Openembedded-devel mailing list
> > Openembedded-devel at lists.openembedded.org
> > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

-- 
Khem Raj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.openembedded.org/pipermail/openembedded-devel/attachments/20090312/833a3ff4/attachment-0005.sig>


More information about the Openembedded-devel mailing list