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 460878 - GimpProgressBar breaks pipe at exit of plug-in
GimpProgressBar breaks pipe at exit of plug-in
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal minor
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2007-07-27 09:48 UTC by Aurimas Juška
Modified: 2007-07-30 16:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase for the bug (5.21 KB, text/x-csrc)
2007-07-27 09:49 UTC, Aurimas Juška
  Details
don't warn if flushing a closed plug-in fails (2.01 KB, patch)
2007-07-30 14:17 UTC, Sven Neumann
none Details | Review
don't call quit_write on a plug-in with a broken pipe (1.69 KB, patch)
2007-07-30 14:42 UTC, Sven Neumann
committed Details | Review

Description Aurimas Juška 2007-07-27 09:48:17 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):
  • #0 ??
    from /lib/libpthread.so.0
  • #1 ??
    from /usr/lib/libglib-2.0.so.0
  • #2 g_io_channel_write_chars
    from /usr/lib/libglib-2.0.so.0
  • #3 gimp_plug_in_flush
    at gimpplugin.c line 697
  • #4 gimp_wire_flush
    at gimpwire.c line 229
  • #5 gp_quit_write
    at gimpprotocol.c line 215
  • #6 gimp_plug_in_close
    at gimpplugin.c line 434
  • #7 gimp_plug_in_recv_message
    at gimpplugin.c line 620
  • #8 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #9 ??
    from /usr/lib/libglib-2.0.so.0
  • #10 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #11 app_run
    at app.c line 246
  • #12 main
    at main.c line 381

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.
Comment 1 Aurimas Juška 2007-07-27 09:49:16 UTC
Created attachment 92535 [details]
Testcase for the bug
Comment 2 Sven Neumann 2007-07-27 13:59:57 UTC
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.
Comment 3 Raphaël Quinet 2007-07-27 21:21:44 UTC
I can confirm this bug.  I tried it on my laptop and got the warning message.
Comment 4 Sven Neumann 2007-07-30 14:16:05 UTC
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.
Comment 5 Sven Neumann 2007-07-30 14:17:44 UTC
Created attachment 92707 [details] [review]
don't warn if flushing a closed plug-in fails
Comment 6 Sven Neumann 2007-07-30 14:42:10 UTC
Created attachment 92709 [details] [review]
don't call quit_write on a plug-in with a broken pipe
Comment 7 Sven Neumann 2007-07-30 16:23:01 UTC
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.
Comment 8 Sven Neumann 2007-07-30 16:26:32 UTC
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.