From 22c112c0b165f922ffa86aba24e3c51fd1655d6c Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mar 19 2019 15:43:55 +0000 Subject: [PATCH 1/2] avoid multiple server_setup calls when multiple threads in use --- diff --git a/hub/kojixmlrpc.py b/hub/kojixmlrpc.py index 9b8ef93..08a344b 100644 --- a/hub/kojixmlrpc.py +++ b/hub/kojixmlrpc.py @@ -27,6 +27,7 @@ import logging import os import sys import time +import threading import traceback import pprint import resource @@ -691,12 +692,16 @@ def server_setup(environ): # firstcall = True +firstcall_lock = threading.Lock() def application(environ, start_response): global firstcall if firstcall: - server_setup(environ) - firstcall = False + with firstcall_lock: + # check again, another thread may be ahead of us + if firstcall: + server_setup(environ) + firstcall = False # XMLRPC uses POST only. Reject anything else if environ['REQUEST_METHOD'] != 'POST': headers = [ From a7b496961cac9f05e06ad208ed4fa76c1458be3a Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mar 19 2019 15:46:50 +0000 Subject: [PATCH 2/2] disable mod_wsgi reloading Fixes: https://pagure.io/koji/issue/875 --- diff --git a/hub/httpd.conf b/hub/httpd.conf index b8cfbaf..8a741d7 100644 --- a/hub/httpd.conf +++ b/hub/httpd.conf @@ -10,6 +10,9 @@ Alias /kojihub /usr/share/koji-hub/kojixmlrpc.py WSGIApplicationGroup %{GLOBAL} # ^ works around a hub issue with OpenSSL # see: https://cryptography.io/en/latest/faq/#starting-cryptography-using-mod-wsgi-produces-an-internalerror-during-a-call-in-register-osrandom-engine + WSGIScriptReloading Off + # ^ reloading breaks hub "firstcall" check + # see: https://pagure.io/koji/issue/875 Order allow,deny Allow from all