我已经使用了lighttpd很长时间了,因为它很快就可以用于繁忙的web应用程序快速cgi(PHP)
2或3个月前有时我得到了这个错误:
2015-07-06 17:58:55: (server.c.1398) [note] sockets enabled again
2015-07-06 17:58:55: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:58:59: (server.c.1398) [note] sockets enabled again
2015-07-06 17:58:59: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:59:05: (server.c.1398) [note] sockets enabled again
2015-07-06 17:59:05: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:59:10: (server.c.1398) [note] sockets enabled again
2015-07-06 17:59:10: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:59:14: (server.c.1398) [note] sockets enabled again
2015-07-06 17:59:14: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:59:18: (server.c.1398) [note] sockets enabled again
2015-07-06 17:59:18: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:59:22: (server.c.1398) [note] sockets enabled again
2015-07-06 17:59:22: (server.c.1446) [note] sockets disabled, out-of-fds
2015-07-06 17:59:26: (server.c.1398) [note] sockets enabled again
2015-07-06 17:59:26: (server.c.1446) [note] sockets disabled, out-of-fds
我使用的是版本1.4.29,现在升级到1.4.35之后问题仍然存在。从那时起,我一直在寻找非常不同的解决方案,并没有找到任何可以帮助我的方法。
一些相关的配置信息:
H 2。 lighttpd.conf
server.username = "lighttpd"
server.groupname = "lighttpd"
server.event-handler = "linux-sysepoll"
server.max-fds = 4096 #same as ulimit -n
server.max-connections = 2048
server.stat-cache-engine = "simple"
server.max-keep-alive-idle = 5
server.max-keep-alive-requests = 4
server.max-read-idle = 30
server.max-write-idle = 360
H 2。快速cgi.conf
server.modules += ( "mod_fastcgi" )
fastcgi.server = ( ".php" =>
( "php-local" =>
(
"socket" => "/tmp/php-fastcgi-1.socket",
# "socket" => "/tmp/php-fastcgi-1.socket"+var.PID,
"bin-path" => "/usr/bin/php-cgi",
"max-procs" => 30,
"broken-scriptfilename" => "enable",
)
),
( "php-tcp" =>
(
"host" => "127.0.0.1",
"port" => 9999,
"check-local" => "disable",
"broken-scriptfilename" => "enable",
)
),
( "php-tcp2" =>
(
"host" => "127.0.0.1",
"port" => 9998,
"check-local" => "disable",
"broken-scriptfilename" => "enable",
)
),
( "php-num-procs" =>
(
"socket" => "/tmp/php-fastcgi-2.socket",
"bin-path" => "/usr/bin/php-cgi",
"max-procs" => 30,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "30",
"PHP_FCGI_MAX_REQUESTS" => "2048",
),
"broken-scriptfilename" => "enable",
)
),
)
此服务器专用于该应用程序。
运行时间超过四年且至少有2个具有大量访问权限的lighttpd php应用程序,该记录在2013年有14,000次独立访问和85,000次页面浏览,然后此记录没有限制的问题。 如今,每天平均有8,000名访问者和44,000次页面浏览量。
出了什么问题?
答案 0 :(得分:1)
lighttpd 1.4保留已打开的(部分)文件描述符的内部计数。 lighttpd 1.4在内部计数(cur_fds + want_fds - src / server.c的1408行)达到lighttpd.conf的server.max-fds的90%时禁用服务器套接字
内部计数可能(未经证实)与实际使用的文件描述符数量不匹配。
如果再次发生这种情况,您会检查lighttpd服务器进程实际使用了多少fds吗?如果lighttpd服务器进程有pid 1234,那么检查Linux上进程的打开fds数
ls -1 /proc/1234/fd/ | wc -l
如果结果远低于server.max-fds(已设置为4096)的90%,则表明lighttpd内部fd计数存在错误。您可以转到http://redmine.lighttpd.net/projects/lighttpd/issues并注册一个帐户。然后,您将能够提交错误报告。
同样,如果这就是问题,您也可以查看您的应用程序,看看它遇到致命错误,死亡和重新启动的频率。