Re: IOError: Too many open files

Mike Driscoll <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAO4gEAv3Lvpdbmh25R1r2isBHY9C8-Lg=00rOWSWCtH8Nry9zg@mail.gmail.com>
Hi Marius,


On Thu, Nov 21, 2013 at 1:27 AM, Marius Gedminas <[email protected]> wrote:

<snip>


> >
> > I tried changing tactics by reading the file into StringIO and passing
> > Image that, but that just moves the issue to where I read the file. For
> > those curious, I do this:
> >
> > with open(self.logo_path, "rb") as logo_fh:
> >             self.logo_path = StringIO( logo_fh.read() )
> >
> > Anyway, now I get the same basic error, but at this line instead.
>
> This is the line that hits the limit, but not necessarily the line that
> leaks open file descriptors.
>
> Can you wrap the code in a try/except: import pdb; pdb.post_mortem() and
> then check what files are open by running 'lsof -p $pid' or
> 'ls -l /proc/$pid/fd' in a shell?
>
> > I am running on CentOS with Python 2.6. Thanks!
>
> Marius Gedminas
> --
> #define QUESTION ((bb) || !(bb)) /* Shakespeare */
>
>
You were right. Doing as you suggested showed that the issue was a logger
object creating lots and lots of handles to the same log file. I'm not sure
why it's doing that, but that definitely takes the issue outside of
Reportlab. Removing the logging call fixes the issue, so now I have to
decide if the outside process's log is "good enough" or if I want to try to
find a way to re-add it.

Thanks again!

-------------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.