0

My client requires the server connection to be persistent for long durations to support old software. I have tried changing the Apache2 KeepAliveTimeout to 0, 5, 30, 100 for testing, but the connection is always closed at ~20seconds. This is how the tshark capture for a session looks like: Tshark capture of HTTPS session . My /etc/apache/apache2.conf settings:

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 1100

I can see that these changes are reflected in Response Headers: Response Headers snap . I also checked the TCP keepalive config files:

# cat /proc/sys/net/ipv4/tcp_keepalive_time
7200
# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
5
# cat /proc/sys/net/ipv4/tcp_keepalive_probes
9

I, now, have no idea why the connection is getting closed with SSL close_notify at ~20 seconds everytime. Can anyone please share some leads for me to check on, to identify what is causing this behavior and possibly fix it.Please let me know if any further info is required. Thankyou

My environment details:

OS: Ubuntu 20.04.4 LTS
Apache2 server version: Apache/2.4.41 (Ubuntu)
OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020

2 Answers2

0

have you also looked at MaxClients and MaxRequestsPerChild: in the settings? keepalive also affects the behavior.

bg

dottore
  • 1
  • 1
  • In apache-2.4 newer names for `MaxClients` is `MaxRequestWorkers` and `MaxRequestsPerChild` is `MaxConnectionsPerChild`. My apache is using `mpm_event_module` with `MaxRequestWorkers 150` and `MaxConnectionsPerChild 0`. I don't think so, but I will enable `mod_status` and confirm if `MaxRequestWorkers` is getting exhausted or not during my work hours. – lazy_maybe Aug 12 '22 at 02:29
0

It possibly could be due to request_timeout module on apache. It's enabled by default with apache2, you can try disabling this mod and check. To specifically modify such timeouts for specific applications you can check the below link -

https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html#:~:text=handshake%3D0%20header%3D0%20body%3D0

  • That was it! I disabled the reqtimeout mod for the vhost using `RequestReadTimeout handshake=0 header=0 body=0` as per https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html . It works as I intended now. – lazy_maybe Aug 16 '22 at 06:52