GLib may busy loop on invalid file descriptors


I ran into an issue the other day where abrtd was polling an invalid
file descriptor. Obviously, there must be a bug in abrtd which closed
the wrong FD even though it was still registered with the mainloop
using g_io_channel_unix_new and g_io_add_watch. However, the failure
mode of GLib to simply busy loop seems quite bad.

Should g_io_unix_check maybe react to (G_IO_HUP | G_IO_ERR | G_IO_NVAL)
in a way that results in an error and the removal of the source? That
is, effectively run a fallback handler application is watching these
error conditions.

A viable solution might be:
 * Return TRUE from g_io_unix_check by always checking for the errors
 * Test again in g_io_unix_dispatch but log an error and return FALSE
   if none of the requested conditions match.



PS: has some info on the
specific issue.

Attachment: signature.asc
Description: This is a digitally signed message part

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]