Re: Bug List



	Here is the report I first filed in April of this year.  I
included the patch back then which sparked a large argument.  The bug
report I later (3 hours later!) file didn't include this information
because the patch was rejected.  

---------

        I have a multi-threaded, module-loading application which uses a
lot of networking code, and is based on glib.  (Okay, okay, it's a chat
server which will eventually be IETF IMPP compatible.  Once the spec
settles down a little.)   

        A few weeks ago I noticed a bug in the application under Linux
where it would try to accept a non-existent connection.  (Which would
block.)  I read this in the Linux man page:  

       If you want accept to never  block  the  listening  socket
       needs  to  have  the  non blocking flag set. Assuming that
       there is always a connection waiting after select returned
       true  is  not  reliable,  because  the connection might be
       removed by  an  asynchronous  network  error  between  the
       select/poll returning and the accept call. The application
       would hang then if the listen socket is not non  blocking.

so I wetn away thinking it was a Linux problem. (That notice doesn't
appear on other OS's man pages.)  Either way, I switched to non-blocking
sockets, and printed out any NULL values that came through.  

        I got a lot of them.  On other machines too.  And, about that
time, I starting trying to find problems with my program with purify.  

        Purify reported that revents in the GPollFD is sometimes read
uninitialized.  This means that g_io_check (or whatever) is being called
before poll_func.  I haven't figured out HOW this happens, but it seems to
be true.  

        This patch initializes revents to zero.  This fixed the ghost
accepts, and makes purify shut up.  Sorry about the long story.  I get
chatty when I haven't had much sleep.  ;^)



--- glib-1.2.7-orig/giounix.c   Tue Mar 23 16:57:39 1999
+++ glib-1.2.7/giounix.c        Thu Apr  6 02:13:47 2000
@@ -286,6 +286,7 @@
 
   watch->pollfd.fd = unix_channel->fd;
   watch->pollfd.events = condition;
+  watch->pollfd.revents = 0;           /* This might get read before a
poll. Zero is safe. */
 
   g_main_add_poll (&watch->pollfd, priority);
 


On 30 Nov 2000, Owen Taylor wrote:

> Benjamin Kahn <xkahn cybersites com> writes:
> 
> > 	I reported a long while back a bug in glib with threads and
> > giochannels.  I beleive the problem was that, in some cases, a network
> > read was reported, when none existed.  The problem was an uninitialized
> > structure, but should never occur.  Did that ever get fixed?  Do I need to
> > dig out the bug report?
> 
> I haven't gone through GLib bug reports yet. The bug seems to be
> still there:
> 
>  http://bugs.gnome.org/db/84/8482.html
> 
> I don't think Sebastian's decipherment is right - if the program
> is actually threaded (something not completely clear in the original
> bug report), then the problem is probably simply that the file
> descriptor is being checked before it is ever polled. The answer
> to the is probably to simply initialize fd->revents to 0 in
> g_main_add_poll(). 
> 
> Regards,
>                                         Owen
>   
> > On 30 Nov 2000, Owen Taylor wrote:
> > 
> > > In preparation for GTK+-1.2.9, I've been tackling the GTK+ bug tracker
> > > over the last day or so. Attached to this is my current semi-sorted,
> > > semi-annotated list of bugs. It's pretty big.
> > > 
> > > There are quite a few bugs here where we asked for more information
> > > quite a while ago and never got any. We don't have a policy now
> > > on when to close such bugs - my recommendation is that we should
> > > probably wait and close them once GTK+-2.0 has been out for a while. 
> > > 
> > > But there is also a fair bit of low-hanging fruit here, that people
> > > could probably tackle with some results. In particular, I'd like
> > > help with the problems in the first section, labelled "Portability
> > > Bugs", which are problems that show up, often from multiple reporters, 
> > > on platforms I don't have access to.
> > > 
> > > Even if these are platform bugs, not GTK+ bugs, it would be nice
> > > to have instructions for workarounds or even just descriptions
> > > of the problems in the GTK+ INSTALL file.
> 

						-Ben

------------------------------------ |\      _,,,--,,_  ,) ----------
Benjamin Kahn                        /,`.-'`'   -,  ;-;;'
(212) 924 - 2220 ext 201            |,4-  ) )-,_ ) /\
ben cybersites com --------------- '---''(_/--' (_/-' ---------------
   I just want to make the world a better place for me to live in.
			-Lucy in a Peanuts comic





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