mod_perl的脚本“使用”加工过程中要在一个紧凑的循环 [英] mod_perl script going in to a tight loop during 'use' processing

查看:267
本文介绍了mod_perl的脚本“使用”加工过程中要在一个紧凑的循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当复杂的问题来形容。我在寻找进一步的调试任何建议。

I have a rather complex problem to describe. I'm looking for any suggestions for further debugging.

我想转换常规的CGI的mod_perl。我发送一个HTTP请求来加载一个页面的脚本,并在该网页上有链接加载通过进一步的脚本检索到的图像(换句话说,图像是通过CGI脚本加载,不只是一个普通的链接) 。因此,当在浏览器中加载页面时,浏览器揭开序幕半打以上请求运行脚本加载图像。

I'm trying to convert to mod_perl from regular cgi. I send an http request to a script that loads up a page, and on that page there are links to load images that are retrieved via further scripts (in other words, the images are loaded via a cgi script, not just a plain link). So when the page loads in the browser, the browser kicks off half a dozen more requests that run scripts to load the images.

第一个脚本(初始页面加载)运行正常,但一段时间后,该Apache服务器进入一个紧密循环(非常高的CPU使用率和已被杀死)处理图像加载脚本时。有时图像加载脚本的一个运行良好,但一还一环,有时候它是循环的第一个图像加载脚本。 strace的不显示在循环过程中任何事情。

The first script (initial page load) runs fine, but sometime after that the apache server goes into a tight loop (very high cpu usage and has to be killed) when processing the image load scripts. Sometimes one of the image load scripts runs fine but a further one loops, sometimes it's the first image load script that loops. strace doesn't show up anything during the loop.

我已经开始在单用户模式(-X)Apache服务器,并与上看到循环开始的地方跟踪运行交互的Perl调试。我已经做了好几次,每次它的使用的语句处理期间开始在完全相同的位置。我看到使用的床边,'需要'的语句将通过与其他垃圾一起,但它总是在停止:

I've started the apache server in single user mode (with -X) and run the interactive perl debugger with trace on to see where the loop starts. I've done this several times, and each time it starts in exactly the same place, during processing of the 'use' statements. I see piles and piles of 'use' and 'require' statements going by, along with other junk, but it always stops at:

Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:97):
97:     eval { local $SIG{__DIE__};
Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:97):
97:     eval { local $SIG{__DIE__};
Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:98):
98:             require XSLoader;
Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:99):
99:             XSLoader::load(__PACKAGE__, $VERSION);
Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:102):
102:    if($@ eq "") {
Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:103):
103:            close(DATA);
Params::Classify::CODE(0x7f43b0b46dd8)(/usr/lib/perl5/Params/Classify.pm:130):
130:    1;
Data::Entropy::CODE(0x7f43b0b46dd8)(/usr/share/perl5/Data/Entropy.pm:46):
46:     use Params::Classify 0.000 qw(is_ref);
Data::Entropy::CODE(0x7f43b0b46dd8)(/usr/share/perl5/Data/Entropy.pm:46):
46:     use Params::Classify 0.000 qw(is_ref);

使用处理的这部分被踢掉在我的脚本:

This section of 'use' processing is kicked off in my script with:

use Authen::Passphrase::BlowfishCrypt;

我已经做了数据::熵,而params ::分类一些搜索,并没有发现什么有用的东西(这是我所期待的 - 我怀疑有一个bug与他们)。

I've done some searches on Data::Entropy and Params::Classify and didn't find anything useful (which is what I expected - I doubt there is a bug with them).

这已经从previous脚本内存损坏的感觉运行,但我还没有确定如何跟踪下来。由于我是新来的mod_perl我想我会通过一些专家运行它,看看他们是否已经遇到类似的事情,或对我如何进一步调试这一建议。

This has the feel of memory corruption from previous script runs, but I'm not sure yet how to track it down. Since I'm new to mod_perl I thought I'd run it by some experts to see if they've run into something similar or have suggestions on how I can further debug this.

运行Apache / 2.2.22的mod_perl / 2.0.5的Perl / 5.14.2。

Running apache/2.2.22 mod_perl/2.0.5 perl/5.14.2.

code是pretty基本的,但在这里它是:

Code is pretty basic, but here it is:

package Wii::Web;

use strict;
use warnings;

use base qw(Wii);

use Data::Dumper;
use Params::Validate qw(:all);
use Log::Log4perl qw(get_logger :easy);
use CGI;
use Carp qw(cluck);
use Email::Valid;
use Authen::Passphrase::BlowfishCrypt;
use Digest::SHA;
use Digest::HMAC;
use Time::HiRes qw(gettimeofday tv_interval);
use Wii::Web::View;
use Wii::Web::Register;
use Wii::Web::Login;
use Wii::Web::Session;
use Wii::Web::User;
use Wii::Web::Found;

$CGI::POST_MAX = 1024 * 5000;

BEGIN {
  $SIG{__DIE__} = \&sigDie;
}

sub sigDie {
  return if $^S; # we are in an eval block

  # assume this is the first print
  my ($error) = @_;
  print "Status: 500\n";
  print "Content-type: text/html\n\n";
  print "<html><body>\n";
  print "<h3>Whoops there was an error!</h3>\n";
  print "<!-- $error  -->\n";
  print "Please try again later<br />\n";
  print "<b>$error</b>\n";
  print "</body></html>\n";

  Wii::sigDie(@_);

  return 1;
}
<snip>

有此一前涉及的其他模块,但是这是序幕问题之一。

There are other modules involved before this one, but this is the one that kicks off the problem.

推荐答案

PARAMS ::分类:: XS不是线程​​安全的。从使用XS到perl Perl版本切换。

Params::Classify::XS is not thread safe. Switch from using the XS to perl Perl version.

这篇关于mod_perl的脚本“使用”加工过程中要在一个紧凑的循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆