mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
8a3a4596e2
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> |
||
---|---|---|
.. | ||
schema-tests | ||
.gitignore | ||
appinfo-test2.desktop | ||
appinfo-test-gnome.desktop | ||
appinfo-test-notgnome.desktop | ||
appinfo-test.c | ||
appinfo-test.desktop | ||
appinfo.c | ||
application.c | ||
async-close-output-stream.c | ||
buffered-input-stream.c | ||
buffered-output-stream.c | ||
contenttype.c | ||
contexts.c | ||
converter-stream.c | ||
data-input-stream.c | ||
data-output-stream.c | ||
de.po | ||
desktop-app-info.c | ||
echo-server.c | ||
enums.xml.template | ||
file.c | ||
filter-cat.c | ||
filter-streams.c | ||
g-file-info.c | ||
g-file.c | ||
g-icon.c | ||
gdbus-addresses.c | ||
gdbus-connection-flush-helper.c | ||
gdbus-connection.c | ||
gdbus-error.c | ||
gdbus-example-export.c | ||
gdbus-example-own-name.c | ||
gdbus-example-peer.c | ||
gdbus-example-proxy-subclass.c | ||
gdbus-example-server.c | ||
gdbus-example-subtree.c | ||
gdbus-example-unix-fd-client.c | ||
gdbus-example-watch-name.c | ||
gdbus-example-watch-proxy.c | ||
gdbus-exit-on-close.c | ||
gdbus-export.c | ||
gdbus-introspection.c | ||
gdbus-names.c | ||
gdbus-non-socket.c | ||
gdbus-peer.c | ||
gdbus-proxy-well-known-name.c | ||
gdbus-proxy.c | ||
gdbus-serialization.c | ||
gdbus-sessionbus.c | ||
gdbus-sessionbus.h | ||
gdbus-tests.c | ||
gdbus-tests.h | ||
gdbus-testserver.py | ||
gdbus-threading.c | ||
gschema-compile.c | ||
gsettings.c | ||
httpd.c | ||
live-g-file.c | ||
live-g-file.txt | ||
Makefile.am | ||
memory-input-stream.c | ||
memory-output-stream.c | ||
network-address.c | ||
org.gtk.test.gschema | ||
org.gtk.test.gschema.xml | ||
readwrite.c | ||
resolver.c | ||
send-data.c | ||
simple-async-result.c | ||
sleepy-stream.c | ||
socket-client.c | ||
socket-common.c | ||
socket-server.c | ||
srvtarget.c | ||
testapp.c | ||
testapps.c | ||
testenum.h | ||
unix-fd.c | ||
unix-streams.c | ||
volumemonitor.c | ||
win32-streams.c |