From e0219c7f39761ccc00f8ef1c73e9787a74feaf5c Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Wed, 24 Oct 2018 13:34:59 +0000 Subject: [PATCH] [FIX] tests: avoid remaining requests From times to times, warning are seen on the runbot during HttpCase tests with the chrome headless browser. Those warning are about Odoo trying to join remaining requests threads. In the dumpstack, the thread seems blocked in the werkzeug handle_one_request method, when trying to read the HTTP request line. One explanation could be that Chrome opens a pre-connect socket for a future use. When the HttpTest cleans the browser, the page stops loading but (probably) keeps the socket open for a while. That could explain the problem. With this commit, a timeout is set on the request handler, in the hope that it closes the pre-connect socket too. Cheery-pick of f9ee8cf to avoid runbot_merge failures. closes odoo/odoo#28193 --- odoo/service/server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/service/server.py b/odoo/service/server.py index d64b93d9e8c..04e13681661 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -100,6 +100,9 @@ class BaseWSGIServerNoBind(LoggingBaseWSGIServerMixIn, werkzeug.serving.BaseWSGI class RequestHandler(werkzeug.serving.WSGIRequestHandler): def setup(self): + # timeout to avoid chrome headless preconnect during tests + if config['test_enable'] or config['test_file']: + self.timeout = 5 # flag the current thread as handling a http request super(RequestHandler, self).setup() me = threading.currentThread()