Hi list, I had problems with a script that went nuts and took 65MB memory and alot of cpu. To track this script down I thought Apache:VMonitor would be perfect, unfortenately I ran into some weird promlems (it said there was an error in mod_perl.h) and i know gcc might be broken on this machine so I started scratching my head and came to the conclusion that this 'oneliner' ought to help me track the error down:
find /www/docs -name '*.cgi' -type f -exec perl -pi -e 's:(#!/usr/bin/perl[ w-]*\s*):$1\nprint STDERR "\\nPID=\$\$ SCRIPT=\$ENV{REQUEST_URI} \\n";\n:s;' {} \; ie, every script now prints it's httpd pid and it's request_uri. So i just started waiting watching top with excitment and when the 65 MB httpd process i greped for the pid in the error_log and got the scriptname and it's arguments. Then i reproduced the error on a server with VMonitor to see if what i missed out. Ok i could see the name of the scrpit but the real problem was with the query_string, choped after a couple of chars. Now, if i understand things right (i tried some tweaking on the module) it's not possible to get more than 64 char. Why is this, and is it really so? I know I'm no Einstein and i presume thousands of ppl have tried tracing similar problems, how did you do it? There must be a more effective way to find it? I know I would've got the script name but since i never thought it would get the input it got chances are it'd take me a long time finding the problem if i only knew the name. /Jon