LiteSpeed Web Server “Resume All Listeners” Workaround

Filed Under: Scripts

I am using LiteSpeed Web Server. It works great when used with the LiteSpeed Cache WordPress plugin. However, sometimes I see that the error.log is filled with the “Resume All Listeners” notice messages.

2019-10-22 14:11:09.999551 [NOTICE] [3490] Resume All Listeners
2019-10-22 14:11:10.493639 [NOTICE] [3490] Resume All Listeners

Here are some stats from the error logs.

# grep -c "Resume All Listeners" error.log.2019_10_22
# grep -c "Resume All Listeners" error.log.2019_10_21
# grep -c "Resume All Listeners" error.log.2019_10_22.01 

On a quick Google search, I landed on the LiteSpeed Wiki page. The gist of the page is following:

  • This notice starts appearing when the “Max Connections” limit is reached.
  • When it starts happening, the server will not serve few requests intermittently. So, you will not get to know about this issue at all unless you have some monitoring scripts in place.
  • There is no way to fix this issue, it will keep on growing and gradually all your sites will go down.
  • The only way to fix this issue is to restart the server.

I have kept the following settings for my LiteSpeed webserver.

LiteSpeed Web Server Tuning Connections Settings

LiteSpeed Web Server Tuning Connections Settings

These are very high numbers and my website traffic is not that much to cross this limit. Still, sometimes I see that my error.log file is getting filled with “Resume All Listeners” notice messages.

Indicators of Resume All Listeners Error

  1. Reduced Traffic: I used Google Analytics to keep track of my website’s traffic. I have seen a drop of around 20% every time this error starts popping up.
  2. Website Monitoring Services: I use Uptime Robot to monitor downtime of my websites. If you get intermittent messages of downtime for your websites but when you check and everything is fine, it could be because of this.
  3. Website Not Loading Sometimes: If everything is fine and suddenly your website is not loading, and the issue is gone when you do refresh or in a couple of minutes, it could be because of this error.
  4. Readers’ Reaching Out: JournalDev is a popular website and many times I get messages from the users that my website is not loading. It’s always a good idea to quickly check the server error log to see if it’s happening randomly for some users because of listeners error.

Fix for Resume All Listeners Error

We know that the only fix is to restart the server. We can’t manually check the servers all the time. That’s why I wrote a simple shell script to check for the “Resume All Listeners” in the error.log file and if it crosses a certain threshold value, then just restart the server.

Since a new error.log file is created on every server restart, we don’t have to worry about the earlier error messages.

Here is the shell script that works for me.


result=`/usr/bin/grep -c "Resume All Listeners" /usr/local/lsws/logs/error.log`

echo $date_time $result >> /root/scripts/lsws_restarts_script_logs.log 

if [ $result -gt 100 ]
	echo $date_time "Restarting LSWS Server" >> /root/scripts/lsws_restarts_script_restart_logs.log
	restart_msg=`/usr/local/lsws/bin/lswsctrl restart`
	sleep 5
	echo $date_time $restart_msg >> /root/scripts/lsws_restarts_script_restart_logs.log
	echo "All Seems Good" >> /root/scripts/lsws_restarts_script_logs.log

I have set it to run every 2 minutes using the crontab command.

*/2 * * * * /root/scripts/ > /dev/null

Note: The script works fine on my Ubuntu server. If you are using any other OS, you might have to make slight changes to get it working.


Now, I am not worried about the LiteSpeed not responding because of connection exhaustion. The script will take the necessary steps to restart the server. If you find the script helpful, do share it with others too.

Generic selectors
Exact matches only
Search in title
Search in content