[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#214387: marked as done (libc6: writev() returns -1 with errno == 0)



Your message dated Mon, 5 Feb 2007 19:33:22 +0100
with message-id <20070205183322.GA25819@mad.intersec.eu>
and subject line Bug#214387: Removing -lpthread from link line avoids the problem
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.2-7
Severity: important

I have noticed this bug since I updated to libc6 2.3.2-7.  It was not
occurring before, with 2.3.1 (I think it was that, I don't recall).

I discovered this bug whilst using gtk-gnutella, which is opening many
file descriptors.  At time, randomly, gtk-gnutella was crashing reporting
an unexpected errno of 0 on a write.  I added some debugging information
at the places where write() or writev() was occurring, something like
(just showing the code for write(), but the same logic happens with writev):

    r = write(bio->fd, data, amount);

    if (r == -1 && errno == 0) {
        g_warning("write(fd=%d, len=%d) returned -1 with errno = 0, "
            "assuming EAGAIN", bio->fd, data);
        errno = EAGAIN;
    }

And I started to see the following warnings:

    write(fd=56, len=6386) returned -1 with errno = 0, assuming EAGAIN

in my logs.  But gtk-gnutella no longer crashed and continued (gtk-gnutella
checks the errno on failed writes and panics if it is none of the expected
values).

HOWEVER, this bug also randomly happens in libX11, in the XlibInt.c file.
When a write() fails, X reports an error via its I/O reporting callback.
Since gtk-gnutella is a GTK+ application, the GDK installs a handler via
XSetIOErrorHandle(), which in turns logs the error, showing errno.

And its shows a line looking like this:

    Fatal IO error 0 (Success) on X server.

Looking at the code for gdk_x_io_error(), the installed callback, 0 represents
the errno.  So the same thing happens in the libX11, where a write() returns
-1 with an errno set to 0.

I don't think it's a kernel bug, because my kernel has not changed since
April 2003, and I NEVER had this problem before upgrading my libc.

I tried to patch XlibInt.c to install the same workaround as I did in
gtk-gnutella, but unfortunately, the xlibs do not compile properly on my
machine, and anyway this problem should be fixed at the root, not by
patching all the libraries that depend on libc!

-- System Information
Debian Release: 2.2
Architecture: i386
Kernel: Linux nice 2.4.19 #6 SMP Mon Apr 7 22:26:13 MEST 2003 i686
Locale: LANG=fr_FR, LC_CTYPE=fr_FR

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-4    The Berkeley database routines [gl



--- End Message ---
--- Begin Message ---
Version: 2.3.5

  no news from submitter for more than two years. closing.

On Sat, Aug 06, 2005 at 07:12:21AM +0900, GOTO Masanori wrote:
> Hi,
> 
> At Fri, 31 Oct 2003 15:11:47 +0100,
> Raphael Manfredi wrote:
> > I've noticed that the problem disappears (did not manifest itself
> > in 6 hours) if I remove the unneeded "-lpthread" in the link
> > line.
> > 
> > The "-lpthread" comes via the "pkg-config --libs libxml-2.0" call
> > but is otherwise unneeded by gtk-gnutella.
> > 
> > This should narrow the scope of your investigation considerably...
> 
> The difference to use pthread is small - when multiple threads are
> used, __libc_writev adds cancellation processing.  If a thread which
> sent cancellation signal, writev may be interrupted.
> 
> BTW, I guess this problem is already fixed in linux kernel 2.6 + glibc
> 2.3.5.  Please check the problem again.  If you notice the problem is
> already fixed, please let us know.
> 
> Regards,
> -- gotom
> 
> 
> 
> 

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpNguXxvMMTW.pgp
Description: PGP signature


--- End Message ---

Reply to: