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 356643 - Cancelling opening a URL doesn't stop download
Cancelling opening a URL doesn't stop download
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.2.x
Other Linux
: Low minor
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-09-18 23:18 UTC by Maciej Katafiasz
Modified: 2008-01-15 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej Katafiasz 2006-09-18 23:18:40 UTC
Cancelling opening a URL doesn't actually stop the wget process, so it still goes in the background. This is only important in case of big files, but then it means wasting disk and bandwith for something that's not going to be used.

Steps to reproduce:
1. Open an URL of a big file, for instance http://pippin.gimp.org/lgm-2006-pippin-gegl.png (103MB)
2. Get bored in the meantime, cancel download
3. Look at network monitor, notice how it still downloads data, and there's wget process in ps output
Comment 1 Sven Neumann 2006-09-19 10:22:09 UTC
GIMP 2.3 doesn't use wget any longer, at least not if gnome-vfs is available. So it's probably not worth to investigate this further.
Comment 2 weskaggs 2006-09-19 16:43:29 UTC
However, if anybody were to contribute a patch that solves the problem, it would probably be worth applying.  (Not all Linux GIMP users will have gnome-vfs in the near future.)
Comment 3 Michael Natterer 2006-09-19 18:47:08 UTC
Wget is a mess. It ignores SIGPIPE and there is no way of disabling this.

The only way of fixing this, except reimplementing without wget, or
completely changing the way gimp deals with plug-in processes, seems to

(1) let the uri plug-in open a process group that wget will automatically
    inherit.

and

(2) in app/plug-in/gimpplugin.c change,

    kill (plug_in->pid, SIGKILL);

    to

    if (getpgid (0) != getpgid (plug_in->pid))
      kill (- plug_in->pid, SIGKILL);
    else
      kill (plug_in->pid, SIGKILL);

The only side effect would be that killing gimp won't kill the uri plug-in,
but it will terminate anyway because it would gimp has crashed.
Comment 4 Sven Neumann 2006-09-20 06:57:38 UTC
Or we could use curl instead of wget. No idea if curl is any better with respect to this, but IIRC there's libcurl so we could probably implement a much saner url backend based on this.
Comment 5 Michael Natterer 2006-09-20 10:32:19 UTC
Fixed in CVS:

2006-09-20  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/gimpplugin.c (gimp_plug_in_close): if the plug-in is
	in a different process group than GIMP, kill the entire group so
	the plug-in's children are killed too.

	* plug-ins/uri/uri-backend-wget.c (uri_backend_load_image): open
	a process group so the wget process gets killed (bug #356643).