ActiveState Perl在负载很重的情况下在IIS上崩溃

时间:2013-03-04 06:12:36

标签: perl iis iis-7.5 application-pool activestate

我在使用IIS 7.5的Windows 2008 Server(64位)上运行ActiveState Perl 5.16.2(32位)时遇到问题。 Perl使用PerlIS.dll和IIS中的ISAPI过滤器运行。

似乎存在与重负载和/或并发连接相关的问题,这些问题会产生看似随机的错误消息。

以下是一些示例错误:

*** 'C:\inetmli\wwwroot\ldope\index.cgi' error message at: 2013/02/28 13:01:07
Variable "%Config" is not imported at C:/Perl/lib/Config.pm line 53.
Variable "%Config" is not imported at C:/Perl/lib/Config.pm line 94.
Global symbol "%Config" requires explicit package name at C:/Perl/lib/Config.pm line 53.
Global symbol "%Config" requires explicit package name at C:/Perl/lib/Config.pm line 94.
Compilation failed in require at C:/Perl/lib/Errno.pm line 8.
BEGIN failed--compilation aborted at C:/Perl/lib/Errno.pm line 8.
Compilation failed in require at C:/Perl/lib/IO/Socket.pm line 18.
BEGIN failed--compilation aborted at C:/Perl/lib/IO/Socket.pm line 18.
Compilation failed in require at C:/Perl/site/lib/Net/LDAP.pm line 9.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/LDAP.pm line 9.
Compilation failed in require at C:\inetmli\wwwroot\test\index.cgi line 4.
BEGIN failed--compilation aborted at C:\inetmli\wwwroot\test\index.cgi line 4.

*** 'C:\inetmli\wwwroot\ldope\index.cgi' error message at: 2013/02/28 13:01:07
String found where operator expected at (eval 4) line 2, near "croak 'usage: $io->getline()'"
    (Do you need to predeclare croak?)
String found where operator expected at (eval 4) line 8, near "croak 'usage: $io->getlines()'"
    (Do you need to predeclare croak?)
String found where operator expected at (eval 4) line 10, near "croak 'Can\'t call $io->getlines in a scalar context, use $io->getline'"
    (Do you need to predeclare croak?)
syntax error at (eval 4) line 2, near "croak 'usage: $io->getline()'"
syntax error at (eval 4) line 8, near "croak 'usage: $io->getlines()'"
syntax error at (eval 4) line 10, near "croak 'Can\'t call $io->getlines in a scalar context, use $io->getline'"
Compilation failed in require at C:/Perl/lib/IO/Socket.pm line 12.
BEGIN failed--compilation aborted at C:/Perl/lib/IO/Socket.pm line 12.
Compilation failed in require at C:/Perl/site/lib/Net/LDAP.pm line 9.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/LDAP.pm line 9.
Compilation failed in require at C:\inetmli\wwwroot\test\index.cgi line 4.
BEGIN failed--compilation aborted at C:\inetmli\wwwroot\test\index.cgi line 4.

*** 'C:\inetmli\wwwroot\ldope\index.cgi' error message at: 2013/02/28 13:01:07
Can't locate loadable object for module main in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/lib/DynaLoader.pm line 99, <DATA> line 635.
    DynaLoader::croak('Can\'t locate loadable object for module main in @INC (@INC c...') called at C:/Perl/lib/DynaLoader.pm line 161
    DynaLoader::bootstrap('main') called at C:/Perl/lib/DynaLoader.pm line 106
    DynaLoader::bootstrap_inherit('main') called at C:/Perl/lib/POSIX.pm line 0
    require POSIX.pm called at C:/Perl/lib/POSIX.pm line 0
    PDF::API2::Util::BEGIN() called at C:/Perl/lib/POSIX.pm line 0
    eval {...} called at C:/Perl/lib/POSIX.pm line 0
    require PDF/API2/Util.pm called at C:/Perl/lib/POSIX.pm line 0
    PDF::API2::BEGIN() called at C:/Perl/lib/POSIX.pm line 0
    eval {...} called at C:/Perl/lib/POSIX.pm line 0
    require PDF/API2.pm called at C:\inetmli\wwwroot\test\index.cgi line 13
Compilation failed in require at C:/Perl/site/lib/PDF/API2/Util.pm line 31, <DATA> line 635.
BEGIN failed--compilation aborted at C:/Perl/site/lib/PDF/API2/Util.pm line 31, <DATA> line 635.
Compilation failed in require at C:/Perl/site/lib/PDF/API2.pm line 9, <DATA> line 635.
BEGIN failed--compilation aborted at C:/Perl/site/lib/PDF/API2.pm line 9, <DATA> line 635.
Compilation failed in require at C:\inetmli\wwwroot\test\index.cgi line 13, <DATA> line 635.

正在执行的脚本是一个使用许多库的非常简单的测试脚本:

use strict;
use Net::LDAP;
require Archive::Zip;
require CAM::PDF;
require DBI;
require Excel::Writer::XLSX;
require HTTP::Request;
require LWP::UserAgent;
require MIME::Base64;
require MIME::QuotedPrint;
require PDF::API2;
require PHP::Serialization;
require Socket;
require Win32::Process;

print "HTTP/1.1 200 OK\nContent-Type: text/plain\n\nI'm OK!";

多次请求此脚本时,我可以经常生成错误,但是什么时候或什么原因导致它没有明显的模式。我甚至设法使用单个最后一行作为脚本来获取错误:

print "HTTP/1.1 200 OK\nContent-Type: text/plain\n\nI'm OK!";

错误是:

*** 'C:\inetmli\wwwroot\ldope\index.cgi' error message at: 2013/02/28 12:26:25
syntax error at C:\inetmli\wwwroot\test\index.cgi line 1, near "K!"
Can't find string terminator '"' anywhere before EOF at C:\inetmli\wwwroot\test\index.cgi line 26, <DATA> line 635.

我必须从我的PC上的多个线程运行脚本数千次才能生成此错误,它只会触发几次。我相信它是由并发访问触发的。

从那个错误看,当它开始解析时,它似乎没有读取整个文件?

这个错误令我烦恼!在重负载服务器上,它会经常生成错误,有时IIS中的整个应用程序池崩溃并且必须重新启动。

有没有人见过这个?有知道的工作吗?我希望保留ISAPI,因为其他选项(PerlEX和FastCGI未经当前代码测试)。

我非常感谢任何帮助或提示,以帮助我解决我的问题。由于我没有在网上找到任何东西,也许它也可以帮助那些看似随机错误信息的人。

到目前为止,我已经尝试过:

  • 在不同的应用程序池中拆分应用程序(只有正面影响是崩溃的应用程序现在仅限于当前的应用程序池)
  • 将多个工作进程添加到单个应用程序池(使错误更少但不会消失)
  • 将处理器亲和力设置为true
  • 设置应用程序池回收非常高和非常低,没有明显效果
  • 使用各种“经典”/“管道”和ASP.NET设置,尽管知道它们可能与它无关
  • Perl 5.14没有这个问题,只有Perl 5.16

有人有更多想法吗?

1 个答案:

答案 0 :(得分:0)

在我的情况下(MacOS)错误在STDOUT-&gt; flush()中随机出现,当线程数大于120时。 我在线程环境中删除了它,问题就消失了。