glib/docs/reference
David Zeuthen 8a3a4596e2 Bug 626748 – Use async methods for writing and handle EAGAIN
If sending a lot of data and/or the other peer is not reading it, then
socket buffers can overflow. This is communicated from the kernel by
returning EAGAIN. In GIO, it is modelled by g_output_stream_write()
and g_socket_send_message() returning G_IO_ERROR_WOULD_BLOCK.

It is also problematic that that we're using synchronous IO in the
shared GDBus IO thread. It means that one GDBusConnection can lock up
others.

It turns out that by porting from g_output_stream_write() to
g_output_stream_write_async() we fix the EAGAIN issue. For GSocket, we
still need to handle things manually (by creating a GSource) as
g_socket_send_message() is used.

We check the new behavior in Michael's producer/consumer test case (at
/gdbus/overflow in gdbus-peer.c) added in the last commit.

Also add a test case that sends and receives a 20 MiB message.

Also add a new `transport' G_DBUS_DEBUG option so it is easy to
inspect partial writes:

 $ G_DBUS_DEBUG=transport ./gdbus-connection -p /gdbus/connection/large_message
 [...]
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 0 on a GSocketOutputStream
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 128000 on a GSocketOutputStream
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 256000 on a GSocketOutputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 43669 bytes of message with serial 4 and
        size 20971669 from offset 20928000 on a GSocketOutputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 16 bytes of message with serial 3 and
        size 20971620 to offset 0 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 15984 bytes of message with serial 3 and
        size 20971620 to offset 16 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 16000 bytes of message with serial 3 and
        size 20971620 to offset 16000 from a GSocketInputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 144000 bytes of message with serial 3 and
        size 20971620 to offset 20720000 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 107620 bytes of message with serial 3 and
        size 20971620 to offset 20864000 from a GSocketInputStream
 OK

https://bugzilla.gnome.org/show_bug.cgi?id=626748

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-16 13:54:13 -04:00
..
gio Bug 626748 – Use async methods for writing and handle EAGAIN 2010-08-16 13:54:13 -04:00
glib GVariant: be more explicit about adopting and returning floating refs 2010-08-13 22:42:24 -04:00
gobject Replace -I with $(glib_INCLUDES) and friends 2010-08-06 13:10:34 -04:00
.gitignore .gitignore manpages (*.1) 2010-05-24 23:21:01 -04:00
AUTHORS Initial revision 1999-08-16 17:58:30 +00:00
ChangeLog Update README files to refer to git 2009-03-31 19:39:16 -04:00
COPYING Initial revision 1999-08-16 17:58:30 +00:00
Makefile.am gio/ docs/reference/gio Merged gio-standalone into glib. 2007-11-26 16:13:05 +00:00
NEWS Initial revision 1999-08-16 17:58:30 +00:00
README Added some simple build instructions. 1999-08-16 18:28:01 +00:00

This package contains the reference documentation
for GLib. For more information about Glib,
see:

 http://www.gtk.org

For information about contributing to the
GLib/GTK+ reference documentation project, see:

 http://www.gtk.org/rdp/

The GLib reference documentation is freely redistributable,
see the file COPYING for details.


REQUIREMENTS
============

To build the documentation, you must have the gtk-doc
package installed. To rebuild the template files,
you must have the current version of the GLib
header files installed.


BUILD
=====

First, run configure to generate the makefiles for this
module. There is one option specific to this package

  --with-html-dir=DIR   top of installed HTML documentation tree


The Makefiles for this module define three targets:

 templates:
  
  Scan the headers and merge the results with the current 
  template files

 sgml:

  Generate SGML files using the DocBook DTD from
  the template files

 html:

  Generate HTML from the SGML files.

To build the documentation, do:

 make sgml
 make html

You should only run the 'make templates' step if you
need to regenerate the templates for a more recent
version of the GLib sources.


INSTALLATION
============

 make install