LiteSpeed Web服务器“恢复所有侦听器”解决方法

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.

我正在使用LiteSpeed Web服务器。 与LiteSpeed Cache WordPress插件一起使用时,它可以很好地工作。 但是,有时我看到error.log中充满了“恢复所有侦听器”通知消息。

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
21086
# grep -c "Resume All Listeners" error.log.2019_10_21
483
# grep -c "Resume All Listeners" error.log.2019_10_22.01 
157314

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

在Google的快速搜索中,我进入了LiteSpeed Wiki页面 。 该页面的要旨如下:

  • 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网络服务器保留了以下设置。

LiteSpeed Web Server Tuning Connections Settings

LiteSpeed Web Server Tuning Connections Settings

LiteSpeed Web服务器调整连接设置

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.

这些数字非常高,我的网站访问量并没有超过这个限制。 但是,有时我仍然看到我的error.log文件充满了“恢复所有侦听器”通知消息。

恢复所有侦听器错误的指标 (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.

    减少流量 :我使用Google Analytics(分析)来跟踪我的网站的流量。 每次开始出现此错误时,我都看到下降了20%。
  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.

    网站监视服务 :我使用Uptime Robot监视我的网站的停机时间。 如果您间歇性地收到有关网站停机的消息,但是当您检查并一切正常时,则可能是因为此。
  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.

    读者的支持 :JournalDev是一个受欢迎的网站,很多时候我收到用户的消息,表明我的网站未加载。 快速检查服务器错误日志以查看是否由于监听器错误而对某些用户随机发生的错误始终是一个好主意。

修复恢复所有侦听器错误 (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.

我们知道唯一的解决方法是重新启动服务器。 我们不能一直手动检查服务器。 这就是为什么我编写了一个简单的Shell脚本来检查error.log文件中的“恢复所有侦听器”,并且如果它超过了某个阈值,则只需重新启动服务器即可。

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

由于每次服务器重新启动时都会创建一个新的error.log文件,因此我们不必担心早期的错误消息。

Here is the shell script that works for me.

这是对我有用的shell脚本。

lsws_restarts_script.sh

lsws_restarts_script.sh

#!/bin/bash

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

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

if [ $result -gt 100 ]
then
	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
else
	echo "All Seems Good" >> /root/scripts/lsws_restarts_script_logs.log
fi

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

我已使用crontab命令将其设置为每2分钟运行一次。

*/2 * * * * /root/scripts/lsws_restarts_script.sh > /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.

注意 :该脚本在我的Ubuntu服务器上运行良好。 如果您使用任何其他操作系统,则可能必须进行一些更改才能使其正常运行。

结论 (Conclusion)

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.

现在,我不必担心LiteSpeed由于连接耗尽而无法响应。 该脚本将采取必要的步骤来重新启动服务器。 如果您认为该脚本有用,请也与他人共享。

翻译自: https://www.journaldev.com/33341/litespeed-web-server-resume-all-listeners-fix-workaround

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值