Further to my post from yesterday, I'm finding out that what I'm trying to do may not be possible.

In short, I am trying to call a potentially long running process (Ghostscript) that is wrapped in some code that sets an alarm, then does an eval to call Ghostscript. Either Ghostscript finishes, or the alarm triggers to catch a runaway page being rendered.

My apache says:

[alex@foo bar]$ sudo /usr/sbin/httpd -V Server version: Apache/2.0.40 Server built: Nov 27 2003 11:04:06 Server's Module Magic Number: xxxxxxxx:x Architecture: 32-bit Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/etc/httpd" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"

I'm not sure if there's anything else on my system that I should be checking.

I've done testing using sudo strace /usr/sbin/httpd -f /home/foo/bar/conf/httpd.conf -X and things seem to go bad as soon as the alarm is set ..

... getgroups32(0x20, 0xbfffeab0) = 1 rt_sigaction(SIGALRM, {0x4044fc80, [], SA_RESTORER, 0x402b88f8}, {SIG_ +DFL}, 8) = 0 time(NULL) = 1164821271 alarm(602) = 0 pipe([9, 10]) = 0 ioctl(9, SNDCTL_TMR_TIMEBASE, 0xbfffe970) = -1 EINVAL (Invalid argumen +t) _llseek(9, 0, 0xbfffe9c0, SEEK_CUR) = -1 ESPIPE (Illegal seek) ioctl(10, SNDCTL_TMR_TIMEBASE, 0xbfffe970) = -1 EINVAL (Invalid argume +nt) _llseek(10, 0, 0xbfffe9c0, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl64(9, F_SETFD, FD_CLOEXEC) = 0 fcntl64(10, F_SETFD, FD_CLOEXEC) = 0 pipe([11, 12]) = 0 ioctl(11, SNDCTL_TMR_TIMEBASE, 0xbfffe970) = -1 EINVAL (Invalid argume +nt) _llseek(11, 0, 0xbfffe9c0, SEEK_CUR) = -1 ESPIPE (Illegal seek) ioctl(12, SNDCTL_TMR_TIMEBASE, 0xbfffe970) = -1 EINVAL (Invalid argume +nt) _llseek(12, 0, 0xbfffe9c0, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl64(11, F_SETFD, FD_CLOEXEC) = 0 fcntl64(12, F_SETFD, FD_CLOEXEC) = 0 ...

Naturally, I googled for this problem and came up with this post which points to this post which actually contains some really interesting discussion. The post in that thread that seems to sum things up is this one, but this isn't 100% decided. This post later in the thread says

So it may be that I can't use alarms to catch runaway code after all.

Has anyone here had experience using alarms under Apache2?

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds


In reply to mod_perl, prefork mpm and alarms by talexb

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.