apache2+ssl hangs on high load
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apache2 (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Apache2 stops accepting connections when using mod_ssl and having more than 1000 processes running. This is only happening on ubuntu 12.04 and only with mod_ssl enabled.
Steps to reproduce:
- take a clean install of ubuntu 12.04 server 64bit (i use english installer and all standard settings)
- execute following commands as root:
$ apt-get update
$ apt-get upgrade
$ apt-get install apache2-mpm-prefork
- change /etc/apache2/
<IfModule mpm_prefork_module>
ServerLimit 1500
StartServers 1500
MinSpareServers 1400
MaxSpareServers 1500
MaxClients 1500
MaxRequests
</IfModule>
- enable mod_ssl and restart apache:
$ a2enmod ssl
$ service apache2 restart
[no further configuration changes requred,
i did not configure any ssl hosts,
only enabled the module]
- verify, that apache is running at least 1001 processes
$ ps ax | grep apache | wc -l
1502
- verify you can connect to localhost:
$ curl http://
<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>
- start high load:
$ ab -n 5000 -c 1000 http://
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://
Licensed to The Apache Software Foundation, http://
Benchmarking localhost (be patient)
Completed 500 requests
apr_poll: The timeout specified has expired (70007)
Total of 998 requests completed
- ready, now apache is not working properly:
$ curl -v http://
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1... connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-
> Host: localhost
> Accept: */*
>
..... silence
There are no errors to find in the logs. After restarting apache it will work for some time,
but continue crashing regurally, if you have some traffic coming to the server.
In my tests i sometimes had crashes even with very few users connecting to the servers.
For greater reproducibility however you will need this high connections number for ab.
This is reproducible, happening every time and i also tested this on 3 different machines.
This is specific to 12.04, as i have the same setup working properly on 11.10 and 12.10.
I'm aware of that 1000 Processes will consume a lot of ram. The machine that is supposed
to run this config has 32GB, so this should not be the problem here.
Notice:
- apache crashed only with mod_ssl enabled
- apache crashed only with >1000 processes: 1000 processes runs fine, 1001 will produce a crash
Additional information:
1) The release of Ubuntu you are using
$ lsb_release -rd
Description: Ubuntu 12.04 LTS
Release: 12.04
2) The version of the package you are using
$ apt-cache policy apache2-mpm-prefork
apache2-
Installed: 2.2.22-1ubuntu1
Candidate: 2.2.22-1ubuntu1
Version table:
*** 2.2.22-1ubuntu1 0
500 http://
100 /var/lib/
3) What you expected to happen
i expect apache to handle the 5000 requests as usual and continue accepting connections afterwards
4) What happened instead
apache handles only 1000 requests and stops accepting new connections at all, which is a disaster for any website running on the host
description: | updated |
Changed in apache2 (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
description: | updated |
I cannot reproduce this on Debian unstable with either 2.2.22-9 or 2.2.22-1.
Wild guess: Do you have a per-user process limit configured in /etc/security/ limits. conf ?
If no, it would be helpful if you could provide a backtrace of the process that curl connects to and hangs. There is some documentation about how to do that in doc/apache2. 2-common/ README. backtrace. But the doc is for Debian. For Ubuntu, the installing of the debugging symbols works differently (maybe someone else can provide a pointer).
/usr/share/