GNOME Bugzilla – Bug 332030
mainloop starts eating cpu if pipes are broken
Last modified: 2006-02-21 15:02:53 UTC
What happens is the following: 1. app adds a watch with g_io_add_watch (channel, G_IO_IN, some_func, some_data) for a pipe to a subprocess. 2. The subprocess dies/gets killed, so that the pipe has an status G_IO_HUP 3. poll always returns immediatly because the pipe is broken 4. the application does not get notified of the broken pipe, because it is only watching for input. Which means that the channel is not destroyed, and the poll will return immediatly again. I'll attach a patch, that tries to prevent this loop, by destroying sources, that the application can't ever get notifications for. This will prevent the mainloop from going into a loop. See also the gnome-vfs bug 332028.
Created attachment 59846 [details] [review] patch that removes the broken sources This patch removes obviously broken sources from the mainloop. I did some guesswork for the win32 part so it is untested.
Surely you realize that changing the return type of the check method in GSourceFuncs would break API?
The app has to watch for HUP | IN.