[Yum-devel] [PATCH] Handle fork/exec failures. BZ 873851

Zdeněk Pavlas zpavlas at redhat.com
Wed Nov 7 09:56:32 UTC 2012


Report the failure as URLGrabError(5) but don't abort other DLs.
---
 urlgrabber/grabber.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

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)
-- 
1.7.4.4



More information about the Yum-devel mailing list