workaround for nasty python/ssl deadlock that has been affecting warcprox, same issue as https://github.com/pyca/cryptography/issues/2911

This commit is contained in:
Noah Levitt 2016-09-23 15:54:31 +01:00
parent 5d44859ba8
commit 6000237c47
2 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,7 @@ except:
setuptools.setup(
name='warcprox',
version='2.0b2.dev28',
version='2.0b2.dev29',
description='WARC writing MITM HTTP/S proxy',
url='https://github.com/internetarchive/warcprox',
author='Noah Levitt',

View File

@ -41,6 +41,7 @@ import certauth.certauth
import warcprox
import re
import rethinkstuff
import cryptography.hazmat.backends.openssl
def _build_arg_parser(prog=os.path.basename(sys.argv[0])):
arg_parser = argparse.ArgumentParser(prog=prog,
@ -213,6 +214,9 @@ def init_controller(args):
return controller
def real_main(args):
# see https://github.com/pyca/cryptography/issues/2911
cryptography.hazmat.backends.openssl.backend.activate_builtin_random()
controller = init_controller(args)
signal.signal(signal.SIGTERM, lambda a,b: controller.stop.set())