httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Underwood <nemesis-li...@icequake.net>
Subject [users@httpd] interesting CGI logging issue
Date Fri, 07 Jan 2005 03:10:18 GMT

Hi,

Just wondering if anyone has seen this before.  I'm having a problem
where CGI script debug output is vanishing instead of being placed in
the error log.  On Apache 1.3.31, here is an strace of a CGI script
being started:

fork(Process 18024 attached
)                                  = 18024
[pid 17748] close(6 <unfinished ...>
[pid 18024] --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
[pid 18024] getpid()                    = 18024
[pid 18024] getrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY,
rlim_max=RLIM_INFINITY}) = 0
[pid 18024] close(5)                    = 0
[pid 18024] dup2(6, 1)                  = 1
[pid 18024] close(6)                    = 0
[pid 18024] close(4)                    = 0
[pid 18024] dup2(3, 0)                  = 0
[pid 18024] close(3)                    = 0
[pid 18024] close(9)                    = 0
[pid 18024] dup2(10, 2)                 = 2
[pid 18024] close(10)                   = 0
[pid 18024] rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0
[pid 18024]
chdir("/afs/icequake.net/users/nemesis/sites/BraShop/Admin/cgi-bin") = 0
[pid 18024] dup2(46, 2)                 = 2
[pid 18024] close(51)                   = 0
[pid 18024] close(50)                   = 0
[pid 18024] close(49)                   = 0
[pid 18024] close(48)                   = 0
[pid 18024] close(47)                   = 0
[pid 18024] close(46)                   = 0
[pid 18024] close(45)                   = 0  
[pid 18024] close(44)                   = 0  
[pid 18024] close(43)                   = 0  
[pid 18024] close(42)                   = 0  
[pid 18024] close(41)                   = 0  
[pid 18024] close(40)                   = 0  
[pid 18024] close(39)                   = 0  
[pid 18024] close(38)                   = 0  
[pid 18024] close(37)                   = 0  
[pid 18024] close(36)                   = 0  
[pid 18024] close(35)                   = 0  
[pid 18024] close(34)                   = 0  
[pid 18024] close(33)                   = 0  
[pid 18024] close(32)                   = 0  
[pid 18024] close(31)                   = 0  
[pid 18024] close(30)                   = 0  
[pid 18024] close(29)                   = 0  
[pid 18024] close(28)                   = 0  
[pid 18024] close(27)                   = 0  
[pid 18024] close(26)                   = 0  
[pid 18024] close(25)                   = 0  
[pid 18024] close(24)                   = 0  
[pid 18024] close(23)                   = 0  
[pid 18024] close(22)                   = 0  
[pid 18024] close(21)                   = 0  
[pid 18024] close(20)                   = 0  
[pid 18024] close(19)                   = 0  
[pid 18024] close(18)                   = 0  
[pid 18024] close(17)                   = 0  
[pid 18024] close(16)                   = 0  
[pid 18024] close(15)                   = 0  
[pid 18024] close(103)                  = 0  
[pid 18024] close(102)                  = 0  
[pid 18024] close(101)                  = 0  
[pid 18024] close(100)                  = 0  
[pid 18024] close(99)                   = 0  
[pid 18024] close(98)                   = 0  
[pid 18024] close(97)                   = 0  
[pid 18024] close(96)                   = 0  
[pid 18024] close(95)                   = 0  
[pid 18024] close(94)                   = 0  
[pid 18024] close(93)                   = 0  
[pid 18024] close(92)                   = 0  
[pid 18024] close(91)                   = 0  
[pid 18024] close(90)                   = 0  
[pid 18024] close(89)                   = 0  
[pid 18024] close(88)                   = 0  
[pid 18024] close(87)                   = 0  
[pid 18024] close(86)                   = 0  
[pid 18024] close(85)                   = 0  
[pid 18024] close(84)                   = 0  
[pid 18024] close(83)                   = 0  
[pid 18024] close(82)                   = 0  
[pid 18024] close(81)                   = 0  
[pid 18024] close(80)                   = 0  
[pid 18024] close(79)                   = 0  
[pid 18024] close(78)                   = 0  
[pid 18024] close(77)                   = 0  
[pid 18024] close(76)                   = 0  
[pid 18024] close(75)                   = 0  
[pid 18024] close(74)                   = 0  
[pid 18024] close(73)                   = 0  
[pid 18024] close(72)                   = 0  
[pid 18024] close(71)                   = 0  
[pid 18024] close(70)                   = 0  
[pid 18024] close(69)                   = 0  
[pid 18024] close(68)                   = 0  
[pid 18024] close(67)                   = 0  
[pid 18024] close(66)                   = 0  
[pid 18024] close(65)                   = 0  
[pid 18024] close(64)                   = 0  
[pid 18024] close(63)                   = 0  
[pid 18024] close(62)                   = 0  
[pid 18024] close(61)                   = 0  
[pid 18024] close(60)                   = 0  
[pid 18024] close(59)                   = 0  
[pid 18024] close(58)                   = 0  
[pid 18024] close(57)                   = 0  
[pid 18024] close(56)                   = 0  
[pid 18024] close(55)                   = 0  
[pid 18024] close(54)                   = 0  
[pid 18024] close(53)                   = 0  
[pid 18024] close(52)                   = 0  
[pid 18024] close(2)                    = 0  
[pid 18024] getpid()                    = 18024
[pid 18024] getrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY,
rlim_max=RLIM_INFINITY}) = 0
[pid 18024] rt_sigaction(SIGRTMIN, {SIG_DFL}, NULL, 8) = 0
[pid 18024] rt_sigaction(SIGRT_1, {SIG_DFL}, NULL, 8) = 0
[pid 18024] rt_sigaction(SIGRT_2, {SIG_DFL}, NULL, 8) = 0
[pid 18024]
execve("/afs/icequake.net/users/nemesis/sites/BraShop/Admin/cgi-bin/nph-admin.pl",
["nph-admin.pl"], [/* 32 vars */]) = 0

[.......................]

[pid 18024]
open("/afs/icequake.net/users/nemesis/sites/BraShop/Admin/cgi-bin/nph-admin.pl",
O_RDONLY|O_LARGEFILE) = 2
[pid 18024] ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbffff5cc) = -1
EINVAL (Invalid argument)
[pid 18024] _llseek(2, 0, [0], SEEK_CUR) = 0 
[pid 18024] fcntl64(2, F_SETFD, FD_CLOEXEC) = 0
[pid 18024] fstat64(2, {st_mode=S_IFREG|0755, st_size=32, ...}) = 0
[pid 18024] rt_sigaction(SIGCHLD, NULL, {SIG_DFL}, 8) = 0
[pid 18024] readlink("/proc/self/exe", "/usr/bin/perl", 4095) = 13
[pid 18024] getpid()                    = 18024
[pid 18024] getppid()                   = 17748
[pid 18024] read(2, "#!/usr/bin/perl\n\nwarn \"hello\";\n\n", 4096) = 32
[pid 18024] read(2, "", 4096)           = 0  
[pid 18024] write(2, "hello at /afs/icequake.net/users"..., 90) = -1
EBADF (Bad file descriptor)
[pid 18024] exit_group(0)               = ?  
Process 18024 detached
<... select resumed> )                  = 1 (in [5])
--- SIGCHLD (Child exited) @ 0 (0) ---


Note that the very last descriptor closed before the execve() is 2,
which was just dup2()'d earlier!  Naturally, perl's fd for the script
becomes 2 since it is the lowest available one, and then it tries to
write debug output to stderr, but now 2 is no longer the pipe with the
apache process, it is now the (read-only) fd for the perl program.

Anyone have a clue what's going on here?  I can only assume apache or
mod_cgi is to blame since close(2) is done before the execve().

Thanks,

-- 
Ryan Underwood, <nemesis@icequake.net>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message