Re: FBReader leaks file descriptors

9 views
Skip to first unread message

Marius Gedminas

unread,
Jan 8, 2007, 11:54:34 AM1/8/07
to FBReader
On Mon, Jan 08, 2007 at 06:26:15PM +0200, Marius Gedminas wrote:
> On Mon, Jan 08, 2007 at 06:03:36PM +0200, Marius Gedminas wrote:
> > I accidentally noticed that FBReader on my Nokia 770 has 2154 open
> > file descriptors. Most of them are /home/user/.FBReader/config.changes.
>
> The bug is in zlibrary/unix/filesystem/ZLUnixFileOutputStream.cpp line
> 40: ZLUnixFileOutputStream::open calls mkstemp. mkstemp creates a
> temporary file, *opens it* and returns the file descriptor.
> ZLUnixFileOutputStream ignores the open file descriptor and instead
> opens the file again, and then later closes it. The descriptor returned
> by mkstemp stays open forever.

Patch to fix it:
http://mg.pov.lt/fbreader/fbreader-0.7.4p-fd-leak-bugfix.diff

I haven't noticed that 0.7.4q was released already. Updating now...

Marius Gedminas
--
Inform all the troops that communications have completely broken down.

signature.asc

Marius Gedminas

unread,
Jan 8, 2007, 12:10:46 PM1/8/07
to FBReader
On Mon, Jan 08, 2007 at 06:54:34PM +0200, Marius Gedminas wrote:
> On Mon, Jan 08, 2007 at 06:26:15PM +0200, Marius Gedminas wrote:
> > On Mon, Jan 08, 2007 at 06:03:36PM +0200, Marius Gedminas wrote:
> > > I accidentally noticed that FBReader on my Nokia 770 has 2154 open
> > > file descriptors. Most of them are /home/user/.FBReader/config.changes.
>
> Patch to fix it:
> http://mg.pov.lt/fbreader/fbreader-0.7.4p-fd-leak-bugfix.diff
>
> I haven't noticed that 0.7.4q was released already. Updating now...

Binary deb of 0.7.4q + fd leak patch is at http://mg.pov.lt/fbreader/ or
my 770 repository.

(Any chance of my next/prev toolbar buttons being integrated upstream,
so that I could stop forking fbreader?)

Marius Gedminas
--
A bus station is where a bus stops, a train station is where a train stops. On
my desk I have a work station...

signature.asc

Marius Gedminas

unread,
Jan 8, 2007, 11:26:15 AM1/8/07
to FBReader
On Mon, Jan 08, 2007 at 06:03:36PM +0200, Marius Gedminas wrote:
> I accidentally noticed that FBReader on my Nokia 770 has 2154 open
> file descriptors. Most of them are /home/user/.FBReader/config.changes.

The bug is in zlibrary/unix/filesystem/ZLUnixFileOutputStream.cpp line


40: ZLUnixFileOutputStream::open calls mkstemp. mkstemp creates a
temporary file, *opens it* and returns the file descriptor.
ZLUnixFileOutputStream ignores the open file descriptor and instead
opens the file again, and then later closes it. The descriptor returned
by mkstemp stays open forever.

> I am using fbreader-maemo2 0.7.4p

Marius Gedminas
--
After having done some test using hi-tech istruments (moving my mouse
during a kernel build) [...]
-- Davide Libenzi on lkml

signature.asc

Marius Gedminas

unread,
Jan 8, 2007, 11:03:37 AM1/8/07
to FBReader
I accidentally noticed that FBReader on my Nokia 770 has 2154 open
file descriptors. Most of them are /home/user/.FBReader/config.changes.

This explains many things I've previously observed:

* My N770 crashes between every couple of days and every couple of
weeks. I now realize that it crashes more often if I am reading a
book or two. Looks like the system runs out of file descriptor and
some important process (often maemo_af_desktop) crashes.

* Sometimes after a crash FBReader restores old saved state instead of
recent saved state. That would probably be when FBReader itself
cannot open config.changes to save the state.

I am using fbreader-maemo2 0.7.4p

Marius Gedminas
--
Every nonempty totally-disconnected perfect compact metric space is
homeomorphic to the Cantor set.

signature.asc

geometer

unread,
Jan 8, 2007, 5:08:42 PM1/8/07
to FBReader
Hi Marius,

thank you very much -- your patch is very significant. Again, as the
previous one (I mean patch for finger tap scrolling). Of course, I will
apply this patch before the next release.

-- Nikolay Pultsin

Reply all
Reply to author
Forward
0 new messages