After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707097 - GSources created by GSocket do not handle G_IO_NVAL
GSources created by GSocket do not handle G_IO_NVAL
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.37.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-08-29 23:35 UTC by Lionel Landwerlin
Modified: 2013-09-11 13:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gsocket: create sources handling G_IO_NVAL (1.65 KB, patch)
2013-08-29 23:36 UTC, Lionel Landwerlin
none Details | Review

Description Lionel Landwerlin 2013-08-29 23:35:16 UTC
If you create a GInputStream out of a GTcpConnection and try to read
asynchronously some data out of it and no data comes out immediatly
and you decide to close that GTcpConnection.

You can decide to gracefully end the connection by setting the
"graceful-disconnect" property to TRUE. In that case the socket is
shutdown() which stops the asynchronous read operation emitting the
G_IO_HUP event on the file descriptor.

If you device to not gracefully end the connection, the socket is just
close(), which now makes the filedescriptor of that socket invalid. In
that case the asynchronous read operation will never terminate because
the GSource doesn't consider the G_IO_NVAL signal on the file
descriptor a valid event to dispatch the callback and let the read
operation terminate with an error. It also constantly wakes up the
GMainLoop which leads to a 100% cpu consumption
(https://bugs.freedesktop.org/show_bug.cgi?id=64923).
Comment 1 Lionel Landwerlin 2013-08-29 23:36:35 UTC
Created attachment 253569 [details] [review]
gsocket: create sources handling G_IO_NVAL
Comment 2 Dan Winship 2013-08-30 12:01:59 UTC
i actually already fixed this in git while we were talking about it yesterday :)
Comment 3 Ross Burton 2013-09-11 10:24:35 UTC
Can we please cherry-pick this back to the stable branch as I tend to hit this once a day or so.
Comment 4 Dan Winship 2013-09-11 12:20:25 UTC
feel free to cherry-pick it, although i don't think there are any plans for another 2.36 release
Comment 5 Lionel Landwerlin 2013-09-11 12:22:48 UTC
Looks like people are experiencing this with gnome-online-account too : https://bugzilla.redhat.com/show_bug.cgi?id=1005619
Comment 6 Dan Winship 2013-09-11 13:48:47 UTC
hm, see also bug 707912; there actually is a bug in glib that ought to have been preventing this case from getting hit. (The attempt to close the stream when there was a read pending should have failed and returned a GError.)