GNOME Bugzilla – Bug 460878
GimpProgressBar breaks pipe at exit of plug-in
Last modified: 2007-07-30 16:26:32 UTC
GimpProgressBar somehow causes broken pipe at exit of plug-in: (gimp-2.3:6135): Gimp-Plug-In-WARNING **: gimp-2.3: plug_in_flush(): error: Broken pipe Stack trace (with --g-fatal-warnings):
+ Trace 150899
Steps to reproduce: 1) gimptool-2.0 --install testcase.c 2) start The Gimp from console 3) create new image (not large, default works fine for me) 4) File > Testcase 5) Press OK to perform 20 blurs in a row (and flood GimpProgressBar with messages). The testcase exits automatically after that and you should see the warning in console.
Created attachment 92535 [details] Testcase for the bug
I can't reproduce the problem with this testcase. But then I am running this on a dual-core CPU and this can change the timings significantly.
I can confirm this bug. I tried it on my laptop and got the warning message.
What happens here is that the plug-in exits and GIMP still tries to deliver messages to it. It notices that the pipe is broken and calls gimp_plug_in_close(). This function then asks the plug-in to exit gracefully before killing it. It is probably a bad idea to attempt sending a message over the write pipe in response to a broken pipe. So one way to work around this problem would be to omit the call to gp_quit_write() in response to the G_IO_HUP condition. In my opinion it is however better to check plug-in->open in gimp_plug_in_flush(). Patch will follow. Before it is applied we should however check why GIMP is still trying to send messages to the plug-in. The progress-bar in the plug-in should be destroyed with the plug-in dialog and it uninstalls the progress callback in the destroy method.
Created attachment 92707 [details] [review] don't warn if flushing a closed plug-in fails
Created attachment 92709 [details] [review] don't call quit_write on a plug-in with a broken pipe
The patch attached in comment #6 removes the warning. The actual cause is the following: When the plug-in run method completes, the plug-in sends a GP_PROC_RETURN message. This is handled by gimp_plug_in_handle_proc_return(). It calls gimp_plug_in_close() which waits for the plug-in to quit. Directly after sending the GP_PROC_RETURN message, the plug-in sends a GP_QUIT message to inform the core about that it is about to quit. This message seems to sometimes cause a G_IO_HUP condition to occur. I will commit the patch now as it seems to be the right way to fix this problem.
2007-07-30 Sven Neumann <sven@gimp.org> * app/plug-in/gimpplugin.[ch]: don't call gp_quit_write() on a plug-in with a broken pipe. Fixes bug #460878.