Hello all,

I am having some issues with a cgi script that I have written that uses LWP::UserAgent to scrape webpages and the runs through each page using a regex to match content and puts said content into a hash. It also extracts links using HTML::SimpleLinkExtor and follows specified links to run the whole process over again. At the end it puts the information into a database.

This script works like a champ on a page with a small amount of content, but when it is presented with a large amount of content it chokes. This script is run on a web server using CGI. There are no errors in the apache logs, nor is any error presented to the screen.

I will spare everyone here from burning their eyes on my hobbled code, but I have a couple of questions about debugging in this kind of scenario. Does anyone use the strace command on the process id? I tried that. This is what I get:

fcntl64(9, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(9, F_SETFL, O_RDWR|O_NONBLOCK) = 0 write(9, "GET /ublank/0___files/4155."..., 416) = 416 select(16, [9], NULL, NULL, {180, 0}) = ? ERESTARTNOHAND (To be rest +arted) --- SIGTERM (Terminated) ---

This is really cryptic and starts to scare me after a while. Can anyone recommend maybe other ways of getting low level debugging output from a script? Does this sound like a memory issue? If so, could it be due to poorly written code, or maybe even buggy perl (5.6.1 on Debian)?

I appreciate everyone's help.

Take care,
ghettofinger


In reply to Methods to debug CGI issues by ghettofinger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.