Re: [gnet-devel] echoserver.exe cause 100% CUP time on WinXP



echoserver-gserver.c did not suffer the 100%CPU problem on Win32.
I think it's better for me to use this as template.

KC


On Thu, Apr 17, 2008 at 11:47 PM, Kuang-Chun Cheng <kcc1967 gmail com> wrote:
> On Thu, Apr 17, 2008 at 5:15 AM, Kuang-Chun Cheng <kcc1967 gmail com> wrote:
>  > Hi,
>  >
>
> >  I think I found the problem.
>  >  In $GNET_2_0_8/src/iochannel.c, function gnet_io_channel_readn()
>  >  use glib call, g_io_channel_read() ... this API cause 100%CPU problem
>  >  under Win32.
>
>  Sorry for wrong information, replacy g_io_channel_read() by
>  newer g_io_channel_read_chars() WILL NOT fix the 100%CPU problem.
>  I put a g_usleep() in my test program, and I forgot I did that before :-(
>
>  So, I still can't find what's going on here.
>  All I knew is g_io_channel_read() or g_io_channel_read_chars() will not block
>  on Win32 ... and this make gnet_io_channel_readline() in echoserver.c goes
>  into a busy loop.
>
>  I check glib manual and found:
>
>  g_io_channel_win32_new_socket ()
>  ...
>  Polling a GSource created to watch a channel for a socket puts the
>  socket in non-blocking mode. This is a side-effect of the
>  implementation and unavoidable.
>  ...
>
>  Could this be the problem ?
>  Or it's just the "feature" of gnet under Win32 ?
>
>
>  KC
>
>
>
>  >
>  >  I'm using glib-2.16.3, and since the document of glib said that
>  >  g_io_channel_read() was deprecated since v2.2 ... so I simply change
>  >  g_io_channel_read() to g_io_channel_read_chars() ...
>  >  and the 100% CPU problem under Win32 goes away.
>  >
>  >  Can someone confirm this.   I can make a patch if anyone is
>  >  interesting with this
>  >  fix (or work around).   But since g_io_channel_read() return GIOError, and
>  >  g_io_channel_read_chars() return GIOStatus.  With return value of
>  >  gnet_io_channel_readn() will also change ... don't know if this break anything
>  >  else.   FYI.
>  >
>  >
>  >  Regards,
>  >  KC
>  >
>  >
>  >
>  >
>  >
>  >
>  >  On Fri, Apr 11, 2008 at 3:44 PM, Kuang-Chun Cheng <kcc1967 gmail com> wrote:
>  >  > Thanks, I will check that.
>  >  >
>  >  >
>  >  >  Best Regards
>  >  >  KC
>  >  >
>  >  >
>  >  >
>  >  >  On Fri, Apr 11, 2008 at 3:37 PM, Dov Grobgeld <dov grobgeld gmail com> wrote:
>  >  >  > Hi Kuang-Chan,
>  >  >  >
>  >  >  > I remember having a similar problems a few years back, but I forgot how I
>  >  >  > solved it! But what I do know is that my xmlrpc-server code in the gnet
>  >  >  > tarball is working on windows. Perhaps it can be of help to get your server
>  >  >  > to work.
>  >  >  >
>  >  >  > Regards,
>  >  >  > Dov
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  > On 11/04/2008, Kuang-Chun Cheng <kcc1967 gmail com> wrote:
>  >  >  > >
>  >  >  > >
>  >  >  > >
>  >  >  > > Hi,
>  >  >  > >
>  >  >  > > I had build gnet-2.0.8 by using cross mingw compiler under Linux.
>  >  >  > > And I found even the simple "echoserver.exe" will cause 100% CPU time
>  >  >  > > under WinXP when client connected to it (after accept return ...)
>  >  >  > >
>  >  >  > > I checked gnet-2.0.7 which also had the similar problem.
>  >  >  > >
>  >  >  > > gnet client did not have such probem, only server (GTcpSocket server).
>  >  >  > >
>  >  >  > > I don't know if it's my cross mingw problem, glib2 problem or gnet2
>  >  >  > problem.
>  >  >  > > Does anyone can suggest where should I looking at.
>  >  >  > > Any code in gnet2 might use 100% CPU when "accept" return ?
>  >  >  > >
>  >  >  > > I will start looking at the source code of gnet2 ... and hopefully
>  >  >  > > also can get some
>  >  >  > > information from here.  Thanks
>  >  >  > >
>  >  >  > > Best Regards,
>  >  >  > > KC
>  >  >  > > _______________________________________________
>  >  >  > > gnet-devel-list mailing list
>  >  >  > > gnet-devel-list gnome org
>  >  >  > > http://mail.gnome.org/mailman/listinfo/gnet-devel-list
>  >  >  > >
>  >  >  >
>  >  >  >
>  >  >
>  >
>


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