[yum-commits] urlgrabber/grabber.py

zpavlas at osuosl.org zpavlas at osuosl.org
Wed Nov 7 14:28:33 UTC 2012


 urlgrabber/grabber.py |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit ef77d7bebd7678ab95b0d271c3f015cf54cf7459
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Wed Nov 7 10:49:44 2012 +0100

    Handle fork/exec failures.  BZ 873851
    
    Report the failure as URLGrabError(5) but don't abort other DLs.

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 74a692c..a22d18d 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -2109,7 +2109,13 @@ class _ExternalDownloaderPool:
         host = urlparse.urlsplit(opts.url).netloc
         dl = self.cache.pop(host, None)
         if not dl:
-            dl = _ExternalDownloader()
+            try:
+                dl = _ExternalDownloader()
+            except OSError, e:
+                # can't spawn downloader, give up now
+                opts.exception = URLGrabError(5, exception2msg(e))
+                _run_callback(opts.failfunc, opts)
+                return
             fl = fcntl.fcntl(dl.stdin, fcntl.F_GETFD)
             fcntl.fcntl(dl.stdin, fcntl.F_SETFD, fl | fcntl.FD_CLOEXEC)
         self.epoll.register(dl.stdout, select.EPOLLIN)


More information about the Yum-commits mailing list