我在带有 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
有人有更多的想法吗?