GNOME Bugzilla – Bug 356643
Cancelling opening a URL doesn't stop download
Last modified: 2008-01-15 13:12:08 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
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.
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.)
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.
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.
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).