Hello, On Solaris/Intel, rotatelogs will always crash right after it is spawned. This only happens on the Solaris/Intel platform. It works fine on Solaris/SPARC, and on Linux, etc. But for some reason, the code that is currently used in Apache 2.0.51 to fork() and exec() processes like rotatelogs, on Solaris/Intel, seems to crash all the time.
I've attached a trace of the processes execution using truss. I narrowed down the output using grep to only show the execution of the fork()'ed child. You can see that shortly after the execve() call is made, the process just dies with SIGSEGV. I've also attached a trace of the process after applying a patch that I've been using for a while (since version 2.0.49, or something). Here is the patch to ./srclib/apr/threadproc/unix/proc.c 449c449,452 < execve(progname, (char * const *)args, (char * const *)env); --- > if (env != NULL) > execve(progname, (char * const *)args, (char * const *)env); > else > execv(progname, (char * const *)args); The above patch has been the only way that I've been able to launch rotatelogs on the Solaris/Intel platform. Comments? Thanks, Mike C.
14901: pipe() = 8 [9] 14901: access("/usr/local/apache/bin/rotatelogs", 5) = 0 14901: fork1() = 14902 14902: fork1() (returning as child ...) = 14901 14902: getpid() = 14902 [14901] 14902: munmap(0xDF7A0000, 20480) = 0 14902: munmap(0xDF7B0000, 20480) = 0 14902: munmap(0xDF307000, 1052672) = 0 14902: munmap(0xDF206000, 1052672) = 0 14902: munmap(0xDF105000, 1052672) = 0 14902: munmap(0xDF004000, 1052672) = 0 14902: munmap(0xDEF03000, 1052672) = 0 14902: munmap(0xDEE02000, 1052672) = 0 14902: munmap(0xDED01000, 1052672) = 0 14902: munmap(0xDEC00000, 1052672) = 0 14902: mmap(0x00000000, 8421376, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xDEC00000 14902: mprotect(0xDEC00000, 4096, PROT_NONE) = 0 14902: mprotect(0xDED01000, 4096, PROT_NONE) = 0 14902: mprotect(0xDEE02000, 4096, PROT_NONE) = 0 14902: mprotect(0xDEF03000, 4096, PROT_NONE) = 0 14902: mprotect(0xDF004000, 4096, PROT_NONE) = 0 14902: mprotect(0xDF105000, 4096, PROT_NONE) = 0 14902: mprotect(0xDF206000, 4096, PROT_NONE) = 0 14902: mprotect(0xDF307000, 4096, PROT_NONE) = 0 14902: sysi86(SI86DSCR, 0x08047688, 0xDFBE7000, 0x00000107) = 0x00000000 14902: lwp_create(0x080476D0, __LWP_ASLWP, 0xDF407DC4) = 2 14902: lwp_create() (returning as new lwp ...) = 0 14902: door_create(0xDF7E46B0, 0x00000000, 0x00000002) = 10 14902: lwp_schedctl(SC_STATE|SC_BLOCK, 10, 0x08047928) = 0 14902: door_info(10, 0xDF800370) = 0 14902: mmap(0x00000000, 20480, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xDF7B0000 14902: mprotect(0xDF7B0000, 4096, PROT_NONE) = 0 14902: sysi86(SI86DSCR, 0x080476B8, 0xDFBE7000, 0x00000117) = 0x00000000 14902: lwp_create(0x08047700, LWP_DETACHED|LWP_SUSPENDED, 0xDF7B4DC4) = 3 14902: lwp_create() (returning as new lwp ...) = 0 14902: lwp_continue(3) = 0 14902: close(10) = 0 14902: lwp_schedctl(SC_STATE|SC_BLOCK, -1, 0xDF7B4D44) = 0 14902: lwp_schedctl(SC_DOOR, 0, 0x00000000) Err#22 EINVAL 14902: lwp_mutex_lock(0xDF800E78) = 0 14902: lwp_cond_signal(0xDF800E68) = 0 14902: lwp_cond_wait(0xDF800E68, 0xDF800E78, 0xDF7FA668) = 0 14902: lwp_self() = 3 14902: close(5) = 0 14902: close(4) = 0 14902: close(7) = 0 14902: close(6) = 0 14902: close(9) = 0 14902: fcntl(8, F_DUP2FD, 0x00000000) = 0 14902: close(8) = 0 14902: sigaction(SIGCLD, 0x080478AC, 0x08047944) = 0 14902: execve("/usr/local/apache/bin/rotatelogs", 0x081C39D0, 0x08047B64) argc = 3 14902: argv: /usr/local/apache/bin/rotatelogs 14902: /usr/local/apache/logs/error_log 86400 14902: envp: PWD=/usr/local/apache/bin 14902: TZ=Canada/Pacific _INIT_RUN_NPREV=0 LC_MESSAGES=C HZ=100 14902: HOSTNAME=fornax _INIT_RUN_LEVEL=3 _INIT_UTS_ISA=i386 14902: _INIT_UTS_SYSNAME=SunOS _INIT_UTS_RELEASE=5.8 PS1=# 14902: _INIT_PREV_LEVEL=S LC_TIME=en_US.ISO8859-1 14902: MACHTYPE=i386-sun-solaris MAIL=/var/mail/mcorcoran 14902: OLDPWD=/tmp/build_spidercache_rp/httpd-2.0.51 14902: _INIT_UTS_VERSION=Generic_108529-23 14902: LC_NUMERIC=en_US.ISO8859-1 LOGNAME=mcorcoran SHLVL=2 14902: _INIT_UTS_NODENAME=fornax _INIT_UTS_PLATFORM=i86pc 14902: LC_CTYPE=en_US.ISO8859-1 _INIT_UTS_MACHINE=i86pc 14902: SHELL=/bin/bash 14902: CVSROOT=:pserver:[EMAIL PROTECTED]:/home/cvsroot 14902: HOSTTYPE=i386 OSTYPE=solaris HOME=/home/mcorcoran TERM=xterm 14902: PATH=/usr/sbin:/usr/bin:/usr/local/bin 14902: LC_MONETARY=en_US.ISO8859-1 LC_COLLATE=en_US.ISO8859-1 14902: _INIT_NET_STRATEGY=none _=/usr/bin/truss 14902: open("/usr/lib/ld.so.1", O_RDONLY) = 3 14902: fxstat(2, 3, 0x080479AC) = 0 14902: mmap(0x00000000, 236188, PROT_READ|PROT_EXEC, MAP_SHARED, 3, 0) = 0xDFB10000 14902: mmap(0x00000000, 212992, PROT_READ|PROT_EXEC, MAP_SHARED, 3, 0) = 0xDFAD0000 14902: mmap(0xDFAD0000, 134124, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xDFAD0000 14902: munmap(0xDFAF1000, 61440) = 0 14902: mmap(0xDFB00000, 12884, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 131072) = 0xDFB00000 14902: open("/dev/zero", O_RDWR) = 4 14902: mmap(0xDFB03000, 596, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 0) = 0xDFB03000 14902: close(3) = 0 14902: resolvepath("/usr/lib/libc.so.1", "/usr/lib/libc.so.1", 1023) = 18 14902: open("/var/ld/ld.config", O_RDONLY) = 3 14902: fxstat(2, 3, 0x08047428) = 0 14902: mmap(0x00000000, 35200, PROT_READ, MAP_SHARED, 3, 0) = 0xDFAC0000 14902: close(3) = 0 14902: sysconfig(_CONFIG_PAGESIZE) = 4096
12360: pipe() = 8 [9] 12360: access("/usr/local/apache/bin/rotatelogs", 5) = 0 12360: fork1() = 12361 12361: fork1() (returning as child ...) = 12360 12361: getpid() = 12361 [12360] 12361: munmap(0xDF7A0000, 20480) = 0 12361: munmap(0xDF7B0000, 20480) = 0 12361: munmap(0xDF307000, 1052672) = 0 12361: munmap(0xDF206000, 1052672) = 0 12361: munmap(0xDF105000, 1052672) = 0 12361: munmap(0xDF004000, 1052672) = 0 12361: munmap(0xDEF03000, 1052672) = 0 12361: munmap(0xDEE02000, 1052672) = 0 12361: munmap(0xDED01000, 1052672) = 0 12361: munmap(0xDEC00000, 1052672) = 0 12361: mmap(0x00000000, 8421376, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xDEC00000 12361: mprotect(0xDEC00000, 4096, PROT_NONE) = 0 12361: mprotect(0xDED01000, 4096, PROT_NONE) = 0 12361: mprotect(0xDEE02000, 4096, PROT_NONE) = 0 12361: mprotect(0xDEF03000, 4096, PROT_NONE) = 0 12361: mprotect(0xDF004000, 4096, PROT_NONE) = 0 12361: mprotect(0xDF105000, 4096, PROT_NONE) = 0 12361: mprotect(0xDF206000, 4096, PROT_NONE) = 0 12361: mprotect(0xDF307000, 4096, PROT_NONE) = 0 12361: sysi86(SI86DSCR, 0x08047688, 0xDFBE7000, 0x00000107) = 0x00000000 12361: lwp_create(0x080476D0, __LWP_ASLWP, 0xDF407DC4) = 2 12361: lwp_create() (returning as new lwp ...) = 0 12361: door_create(0xDF7E46B0, 0x00000000, 0x00000002) = 10 12361: lwp_schedctl(SC_STATE|SC_BLOCK, 10, 0x08047928) = 0 12361: door_info(10, 0xDF800370) = 0 12361: mmap(0x00000000, 20480, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON, -1, 0) = 0xDF7B0000 12361: mprotect(0xDF7B0000, 4096, PROT_NONE) = 0 12361: sysi86(SI86DSCR, 0x080476B8, 0xDFBE7000, 0x00000117) = 0x00000000 12361: lwp_create(0x08047700, LWP_DETACHED|LWP_SUSPENDED, 0xDF7B4DC4) = 3 12361: lwp_create() (returning as new lwp ...) = 0 12361: lwp_continue(3) = 0 12361: close(10) = 0 12361: lwp_schedctl(SC_STATE|SC_BLOCK, -1, 0xDF7B4D44) = 0 12361: lwp_schedctl(SC_DOOR, 0, 0x00000000) Err#22 EINVAL 12361: lwp_mutex_lock(0xDF800E78) = 0 12361: lwp_cond_signal(0xDF800E68) = 0 12361: lwp_cond_wait(0xDF800E68, 0xDF800E78, 0xDF7FA668) = 0 12361: lwp_self() = 3 12361: close(5) = 0 12361: close(4) = 0 12361: close(7) = 0 12361: close(6) = 0 12361: close(9) = 0 12361: fcntl(8, F_DUP2FD, 0x00000000) = 0 12361: close(8) = 0 12361: sigaction(SIGCLD, 0x080478AC, 0x08047944) = 0 12361: execve("/usr/local/apache/bin/rotatelogs", 0x081C39D0, 0x00000000) argc = 3 12361: argv: /usr/local/apache/bin/rotatelogs 12361: /usr/local/apache/logs/error_log 86400 12361: envp: 12361: open("/usr/lib/ld.so.1", O_RDONLY) = 3 12361: fxstat(2, 3, 0x08047D64) = 0 12361: mmap(0x00000000, 236188, PROT_READ|PROT_EXEC, MAP_SHARED, 3, 0) = 0xDFB10000 12361: mmap(0x00000000, 212992, PROT_READ|PROT_EXEC, MAP_SHARED, 3, 0) = 0xDFAD0000 12361: mmap(0xDFAD0000, 134124, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xDFAD0000 12361: munmap(0xDFAF1000, 61440) = 0 12361: mmap(0xDFB00000, 12884, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 131072) = 0xDFB00000 12361: open("/dev/zero", O_RDWR) = 4 12361: mmap(0xDFB03000, 596, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 0) = 0xDFB03000 12361: close(3) = 0 12361: Incurred fault #6, FLTBOUNDS %pc = 0xDFADA23F 12361: siginfo: SIGSEGV SEGV_MAPERR addr=0x00000007 12361: Received signal #11, SIGSEGV [default] 12361: siginfo: SIGSEGV SEGV_MAPERR addr=0x00000007 12361: *** process killed ***