diff --git a/setup.py b/setup.py index 750c392..e096aad 100755 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ except: setuptools.setup( name='warcprox', - version='2.1b1.dev61', + version='2.1b1.dev62', description='WARC writing MITM HTTP/S proxy', url='https://github.com/internetarchive/warcprox', author='Noah Levitt', diff --git a/warcprox/writerthread.py b/warcprox/writerthread.py index 00238d4..34a2b4e 100644 --- a/warcprox/writerthread.py +++ b/warcprox/writerthread.py @@ -39,6 +39,7 @@ import hanzo.httptools from hanzo import warctools import warcprox import cProfile +import sys class WarcWriterThread(threading.Thread): logger = logging.getLogger("warcprox.warcproxwriter.WarcWriterThread") @@ -102,8 +103,18 @@ class WarcWriterThread(threading.Thread): self.logger.info('WarcWriterThread shutting down') self.writer_pool.close_writers() - except: - self.logger.critical("WarcWriterThread will try to continue after unexpected error", exc_info=True) + except BaseException as e: + if isinstance(e, OSError) and e.errno == 28: + # OSError: [Errno 28] No space left on device + self.logger.critical( + 'shutting down due to fatal problem: %s: %s', + e.__class__.__name__, e) + self.writer_pool.close_writers() + sys.exit(1) + + self.logger.critical( + 'WarcWriterThread will try to continue after unexpected ' + 'error', exc_info=True) time.sleep(0.5) # closest thing we have to heritrix crawl log at the moment