[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
This commit is contained in:
parent
43cff22950
commit
8245c1d1d8
|
@ -773,6 +773,7 @@ class WorkerHTTP(Worker):
|
||||||
""" HTTP Request workers """
|
""" HTTP Request workers """
|
||||||
def process_request(self, client, addr):
|
def process_request(self, client, addr):
|
||||||
client.setblocking(1)
|
client.setblocking(1)
|
||||||
|
client.settimeout(0.5)
|
||||||
client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
# Prevent fd inherientence close_on_exec
|
# Prevent fd inherientence close_on_exec
|
||||||
flags = fcntl.fcntl(client, fcntl.F_GETFD) | fcntl.FD_CLOEXEC
|
flags = fcntl.fcntl(client, fcntl.F_GETFD) | fcntl.FD_CLOEXEC
|
||||||
|
|
Loading…
Reference in New Issue