From f9ee8cff1445044d4b12dd357f11e411bacc5917 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Wed, 24 Oct 2018 15:34:59 +0200 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. --- odoo/service/server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/odoo/service/server.py b/odoo/service/server.py index 034409b7c32..7d36ec9a3cc 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -87,6 +87,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()