I have Apache 1.3.12 installed on Solaris 2.7 running with
mod_perl 1.24.  I have a simple mod_perl script, it actually
uses Apache::Registry, that uses a Perl module called RRDs
that can generate images/graphs from a round robin
database.  If you pass it a '-' as a file name rrd_graph.c
prints to 'stdout', or file descriptor 1.  Everything works
just fine if I run the script using mod_cgi as the handler.
But when using mod_perl I get a 200 response from the server
but no data sent to the socket the request came in on.

I just install Perl 5.6 with sfio (safe and fast I/O).
There was no difference in the way the script was handled.
I did see something interesting in the output of truss when
running it on the pid of httpd -X and requesting the script
that generates a Content-type: image/gif header followed by
the raw gif file.

This is edited for brevity:

#  A socket is created using file descriptor #3
getsockname(3, 0xFFBEF860, 0xFFBEF874, 1)       = 0
setsockopt(3, 6, 1, 0xFFBEF7C4, 4, 1)           = 0
alarm(300)                                      = 0

#  Here is the HTTP GET request on the socket using fd #3
read(3, " G E T   / p e r l / i m".., 4096)     = 362

#  Now the script that was requested gets opened on file
descriptor #4
stat64("/usr/local/mod_perl/image_out.cgi", 0x003AECD8) = 0
open64("/usr/local/mod_perl/image_out.cgi", O_RDONLY) = 4
fstat64(4, 0xFFBED058)                          = 0
ioctl(4, TCGETA, 0xFFBECFE4)                    Err#25
ENOTTY
read(4, " # ! / u s r / l o c a l".., 8192)     = 3815
read(4, 0x007E400C, 8192)                       = 0
llseek(4, 0, SEEK_CUR)                          = 3815
close(4)                                        = 0

#  Apache sends the status code 200 indicating success
write(3, " H T T P / 1 . 1   2 0 0".., 186)     = 186

#  The RRD file gets opened on file descriptor #4
open("/usr/local/router/data/some_router/srp000.rrd",
O_RDONLY) = 4
read(4, " R R D\0 0 0 0 1\0\0\0\0".., 8192)     = 8192
llseek(4, 0, SEEK_CUR)                          = 8192
lseek(4, 8428, SEEK_SET)                        = 8428
read(4, "7FFFFFFFFFFFFFFF7FFFFFFF".., 8192)     = 8192
lseek(4, 2796, SEEK_SET)                        = 2796
read(4, "7FFFFFFFFFFFFFFF7FFFFFFF".., 8192)     = 8192
llseek(4, 0xFFFFFFFFFFFFF600, SEEK_CUR)         = 8428
close(4)                                        = 0

#  Now the interesting part;  Instead of writing the image
to the socket (file
descriptor #4)
#  it writes to stdout or file descriptor #1
ioctl(1, TCGETA, 0xFFBEE4EC)                    = 0
write(1, " G I F 8 7 aB7021001B3\0".., 1024)    = 1024
write(1, "\f rD2 j /CE zF3EE ?188A".., 441)     = 441

#  Apache writes to the access_log
write(19, " 10.0.0.1".., 148)    = 148

#  Now the child process blocks on accept waiting for
another request
accept(16, 0xFFBEF850, 0xFFBEF874, 1) (sleeping...)

Well now with all that said, I still don't know why it is
not printing to the
socket or file descriptor #4.  Any ideas?

Reply via email to