From 8245c1d1d87b443701b161d8d4a42df2b4d13aec Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 1 Jun 2016 18:39:18 +0200 Subject: [PATCH] [FIX] service.server: drop idle connection attempts Avoid wasting HTTP workers (in prefork server mode) for pending/idle connections. HTTP connections that have not sent anything for 500ms will be dropped. In particular, wkhtmltopdf uses a connection pool to load remote resources. It opens more HTTP connections than necessary and uses a random subset of them, leaving the other idle. On a server that has little available workers this may significantly delay report rendering, and could even lead to a deadlock. OPW-667870 --- openerp/service/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/service/server.py b/openerp/service/server.py index f2d67c000ef..c111af01093 100644 --- a/openerp/service/server.py +++ b/openerp/service/server.py @@ -773,6 +773,7 @@ class WorkerHTTP(Worker): """ HTTP Request workers """ def process_request(self, client, addr): client.setblocking(1) + client.settimeout(0.5) client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) # Prevent fd inherientence close_on_exec flags = fcntl.fcntl(client, fcntl.F_GETFD) | fcntl.FD_CLOEXEC