glib/gio/tests
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
..
schema-tests Bug 622124 - implement flags for GSettings 2010-07-01 19:06:02 -04:00
.gitignore remove a junk line 2010-08-04 07:36:34 -04:00
appinfo-test2.desktop Cleanups 2010-07-05 00:56:12 -04:00
appinfo-test-gnome.desktop Add some more appinfo tests 2010-07-04 20:51:06 -04:00
appinfo-test-notgnome.desktop Add some more appinfo tests 2010-07-04 20:51:06 -04:00
appinfo-test.c Merge the wip/gapplication branch 2010-06-07 13:48:42 -04:00
appinfo-test.desktop Add some more appinfo tests 2010-07-04 20:51:06 -04:00
appinfo.c Add tests about file associations 2010-07-30 19:51:20 -04:00
application.c Clean up improper #includes 2010-08-06 13:05:18 -04:00
async-close-output-stream.c Add bug references to some tests 2010-08-13 21:23:23 -04:00
buffered-input-stream.c Improve coverage of stream tests 2010-07-30 19:51:20 -04:00
buffered-output-stream.c Improve coverage of buffered output stream tests 2010-07-30 19:51:21 -04:00
contenttype.c Misc test additions 2010-07-05 03:09:36 -04:00
contexts.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
converter-stream.c Add bug references to some tests 2010-08-13 21:23:23 -04:00
data-input-stream.c Improve coverage of stream tests 2010-07-30 19:51:20 -04:00
data-output-stream.c Improve coverage of stream tests 2010-07-30 19:51:20 -04:00
de.po Merge GSettings tests 2010-04-17 01:48:05 -04:00
desktop-app-info.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
echo-server.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
enums.xml.template GSettings: major refactor. Add enums, range. 2010-06-16 18:17:53 -04:00
file.c Add tests for async file replace and load 2010-08-13 19:40:48 -04:00
filter-cat.c Fix GZlibCompressorFormat names 2009-11-24 13:02:05 +01:00
filter-streams.c Fix warning 2010-06-09 10:32:36 +02:00
g-file-info.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
g-file.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
g-icon.c Improve coverage of icon tests 2010-07-30 19:51:20 -04:00
gdbus-addresses.c Improve dbus address test coverage 2010-08-08 21:32:03 -04:00
gdbus-connection-flush-helper.c Bug 618882 – No way to ensure that a message is sent 2010-07-07 15:03:03 -04:00
gdbus-connection.c Bug 626748 – Use async methods for writing and handle EAGAIN 2010-08-16 13:54:13 -04:00
gdbus-error.c Add some more test about gdbus_error apis 2010-08-07 18:55:21 -04:00
gdbus-example-export.c remove the redundant interface_name parameter 2010-05-13 13:09:58 -04:00
gdbus-example-own-name.c Strip copyright headers from examples 2010-05-11 15:50:19 -04:00
gdbus-example-peer.c GDBusConnection.call(): add 'reply_type' argument 2010-05-24 17:00:04 -04:00
gdbus-example-proxy-subclass.c Bug 621213 – GDBusProxy and well-known names 2010-06-11 18:21:27 -04:00
gdbus-example-server.c GDBus: Add GDBusSendMessageFlags 2010-07-19 16:07:57 -04:00
gdbus-example-subtree.c Update the GDBus subtree example for the new API 2010-07-19 15:03:54 -04:00
gdbus-example-unix-fd-client.c GDBus: Add GDBusSendMessageFlags 2010-07-19 16:07:57 -04:00
gdbus-example-watch-name.c Strip copyright headers from examples 2010-05-11 15:50:19 -04:00
gdbus-example-watch-proxy.c Bug 621213 – GDBusProxy and well-known names 2010-06-11 18:21:27 -04:00
gdbus-exit-on-close.c Fix gdbus-exit-on-close test case 2010-08-03 12:47:07 -04:00
gdbus-export.c GDBus: Remove constness from introspection data structures 2010-07-19 15:45:27 -04:00
gdbus-introspection.c GDBus: Remove constness from introspection data structures 2010-07-19 15:45:27 -04:00
gdbus-names.c Make the closure variants of name owning and watching actually work 2010-08-07 17:10:17 -04:00
gdbus-non-socket.c Bug 626841 – Add test-case for non-socket GIOStream 2010-08-13 14:01:36 -04:00
gdbus-peer.c Bug 626748 – Use async methods for writing and handle EAGAIN 2010-08-16 13:54:13 -04:00
gdbus-proxy-well-known-name.c Bug 621213 – GDBusProxy and well-known names 2010-06-11 18:21:27 -04:00
gdbus-proxy.c Improve gdbus test coverage 2010-07-31 00:13:02 -04:00
gdbus-serialization.c GDBusMessage: Validate header fields when serializing/deserializing 2010-08-04 14:38:51 -04:00
gdbus-sessionbus.c More copyright year updates 2010-05-10 08:07:28 -04:00
gdbus-sessionbus.h Initial GDBus code-drop from GDBus-standalone repo 2010-05-06 14:21:32 -04:00
gdbus-tests.c GDBus: Add GDBusAuthObserver param in g_dbus_connection_new_for_address() 2010-05-13 16:32:11 -04:00
gdbus-tests.h Initial GDBus code-drop from GDBus-standalone repo 2010-05-06 14:21:32 -04:00
gdbus-testserver.py GDBus: Remove cached value if a property is invalidated 2010-05-14 12:56:09 -04:00
gdbus-threading.c GDBus: Add GDBusSignalFlags and use it in g_dbus_connection_signal_subscribe() 2010-07-19 15:05:10 -04:00
gschema-compile.c Clean up improper #includes 2010-08-06 13:05:18 -04:00
gsettings.c GSettings: add G_SETTINGS_BIND_INVERT_BOOLEAN flag 2010-08-03 02:09:10 -04:00
httpd.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
live-g-file.c Adapt to recent MLS changes 2010-07-09 07:24:08 -04:00
live-g-file.txt Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
Makefile.am Bug 626841 – Add test-case for non-socket GIOStream 2010-08-13 14:01:36 -04:00
memory-input-stream.c Improve coverage of memory stream tests 2010-07-30 19:51:21 -04:00
memory-output-stream.c Improve coverage of memory stream tests 2010-07-30 19:51:21 -04:00
network-address.c Fix a warning 2010-07-30 19:51:18 -04:00
org.gtk.test.gschema Merge GSettings tests 2010-04-17 01:48:05 -04:00
org.gtk.test.gschema.xml GSettings: add G_SETTINGS_BIND_INVERT_BOOLEAN flag 2010-08-03 02:09:10 -04:00
readwrite.c Test for unexisting files in $TMP and not in $HOME 2010-02-23 18:37:39 +01:00
resolver.c Bug 591216 - Warning building resolver.o 2009-11-11 23:21:48 -05:00
send-data.c GSocketClient: add a timeout property 2010-08-14 15:26:16 -04:00
simple-async-result.c Improve the async result test coverage 2010-08-08 21:32:03 -04:00
sleepy-stream.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
socket-client.c remove broken useless initialization in socket-client/socket-server 2010-05-07 19:08:13 -04:00
socket-common.c gio/tests/socket-client, socket-server: fix for win32 2010-04-23 12:24:30 -04:00
socket-server.c remove broken useless initialization in socket-client/socket-server 2010-05-07 19:08:13 -04:00
srvtarget.c Revert "Move gio tests from gio/tests/ to tests/gio/" 2009-07-05 22:49:24 -04:00
testapp.c Clean up improper #includes 2010-08-06 13:05:18 -04:00
testapps.c GDBus: Add GDBusSignalFlags and use it in g_dbus_connection_signal_subscribe() 2010-07-19 15:05:10 -04:00
testenum.h Bug 622124 - implement flags for GSettings 2010-07-01 19:06:02 -04:00
unix-fd.c GUnixSocketAddress: handle abstract sockets with non-0-padded names 2010-04-22 11:54:41 -04:00
unix-streams.c Fix a possible deadlock 2010-08-03 10:41:21 -04:00
volumemonitor.c Run volumemonitor test with local vfs 2010-08-13 17:23:44 -04:00
win32-streams.c Add GWin32InputStream and GWin32OutputStream classes 2010-04-19 11:54:56 +03:00