talexb has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl, prefork mpm and alarms
by rhesa (Vicar) on Nov 29, 2006 at 19:12 UTC | |
|
Re: mod_perl, prefork mpm and alarms
by jbert (Priest) on Nov 29, 2006 at 19:03 UTC | |
|
Re: mod_perl, prefork mpm and alarms
by shmem (Chancellor) on Nov 29, 2006 at 19:09 UTC | |
|
Re: mod_perl, prefork mpm and alarms
by perrin (Chancellor) on Nov 29, 2006 at 19:15 UTC | |
by talexb (Chancellor) on Nov 29, 2006 at 19:19 UTC | |
by perrin (Chancellor) on Nov 29, 2006 at 19:38 UTC | |
by talexb (Chancellor) on Nov 29, 2006 at 20:05 UTC | |
by perrin (Chancellor) on Nov 29, 2006 at 20:26 UTC | |
| |
|
Re: mod_perl, prefork mpm and alarms
by gam3 (Curate) on Nov 30, 2006 at 04:15 UTC |