GNOME Bugzilla – Bug 122291
GIOChannel loses data when sending large block in buffered mode
Last modified: 2011-02-18 16:07:24 UTC
In Pan, we use GIOChannel to communicate with the NNTP server. We've noticed that, when sending a large post, GIOChannel loses data when it's in buffered mode (see bug #119285). The workaround is to switch to non-buffered mode when sending, though I'd like to understand whether this behaviour isn't a glib bug and if not, why we're seeing this. I'll attach two programs that reproduce this problem. server.c is a pure libc-based server and client.c is a glib-based client, implementing both buffered and non-buffered sending. The client uses gnet to establish the connection, though that's easily changed, if you do not have gnet installed. The protocol is NNTP-like: --> DATA <n> (number of bytes to expect) <-- OK <n> (number of bytes to expect) --> XXXX...X (n bytes of data) <-- OK <n> (number of bytes received) This works OK over loopback (lo), but going over an ADSL line, the server will not receive all data most of the time. Compile as: $ cc -g -Wall -o server server.c $ cc -g -Wall `pkg-config --cflags gnet-2.0` -o ../bin/glib client.c `pkg-config --libs gnet-2.0` $ cc -g -Wall `pkg-config --cflags gnet-2.0` -o ../bin/glib-unbuf client.c `pkg-config --libs gnet-2.0` -DUNBUFFERED
Created attachment 19928 [details] server.c
Created attachment 19929 [details] client.c
Yes, we need a non-GNET-based test case. (Installing GNET is one issue. Another is verifying that it isn't the actual cause of the problem.)
Created attachment 19965 [details] non-gnet client. Compile w/ -DUNBUFFERED for unbuffered writes
owen: ping? :)
My comment above was just a comment about what was needed in general in order there to be any chance that a GLib developer would be able to look at the bug; not saying "if you provide such a test case, I'll debug it". I'm going to spend about 10 minutes looking at this now; if that doesn't turn anything up, well, we'd really appreciate getting help in looking into this...
I can't reproduce any problems with the connection round tripped over an ADSL line with 30ms of latency each way. All 20000 bytes are sent succesfully every time.
owen: apologies. didn't mean to push. :) We had a release due, so wanted to check for progress. We've got a workaround for this in Pan, so the urgency's gone. Since I no longer have a suitable test environment, feel free to close / mark as needinfo.