[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.
This commit is contained in:
Christophe Monniez
2018-10-25 17:16:34 +02:00
parent cc8e8237bf
commit f9ee8cff14
+3
View File
@@ -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()