Ron Phipps wrote:
>Hello,
>>I've been seeing something weird on a site we built, an interchange
>process is running for a long time and eating up processor and memory,
>here is a capture from top:
>> PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU
>COMMAND
>30930 ic50 15 0 36476 35M 2232 R 98.1 2.3 103:59 0
>interchange
>>As you can see it's taking a lot of CPU time and eating up a lot of the
>available CPU. If we let it run long enough the site will no longer
>respond and an Internal error is presented in a web browser.
>>This can be caused by an infinite loop within Perl code
([perl], Usertag, ....). Finally the process will be killed by
IC itself. You can strace it to check if it does any system
calls.
>Is there a way to see what IC is doing? Perhaps some debugging
>statements in key places will let us know what IC is doing and why it's
>taking so much CPU? This state happens even after a restart and is
>pretty sporadic how long after a restart it occurs.
>>You can log information about IC requests during autostart
like that:
Sub <<EOS
sub record_request {
$Tag->perl({tables => 'ic_requests'});
my %parms = (pid => $Tag->getpid(),
agent => $Session->{browser} || '',
url => $Session->{last_url} || '',
cgi_parms => uneval($CGI),
entered => $Tag->time({body => '%Y%m%d %H%M%S'}),
session => $Session->{id} || 0);
$Tag->tmp('request_id',
$Db{ic_requests}->set_slice('', %parms));
return $Scratch->{request_id};
}
EOS
And remove the request in case of success in Autoend:
Sub <<EOS
sub remove_request {
$Tag->perl({tables => 'ic_requests'});
if ($Scratch->{request_id}) {
return $Db{ic_requests}->delete_record($Scratch->{request_id});
}
}
EOS
getpid:
UserTag getpid Routine <<EOR
sub {
return $$;
}
EOR
Bye
Racke