Re: [EMAIL PROTECTED] Solaris SIGBUS and core on changes to mmap'd files

2006-01-20 Thread Joe Orton
On Thu, Jan 19, 2006 at 06:08:21PM -, Matt Willsher wrote:
 I have a set up where by Apache serves static content from an NFS share.
 This works ok most of the time but we have been getting occasional BUS
 signals, resulting in core dump, when reading files. This apparently occurs
 because the requested file changes between it being mmap'd and the memcpy. 

This is a known issue with 1.3.  Upgrade to 2.0, and the server will 
usually use sendfile(), which avoids the problem, and the EnableMMAP and 
EnableSendfile directives are available to control it precisely.

In general if files on your site are modified in-place you will 
sometimes be serving corrupt content, so this situation is generally 
better avoided in the first place.

Regards,

joe

-
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: [EMAIL PROTECTED]
  from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[EMAIL PROTECTED] Solaris SIGBUS and core on changes to mmap'd files

2006-01-19 Thread Matt Willsher
Hello,

I'm having some problems with Apache 1.3.x on Solaris.

I was running Apache 1.3.26 on Solaris 8 and have upgrade to Apache 1.3.34
on Solaris 9 and we see this same issue on both platforms.

I have a set up where by Apache serves static content from an NFS share.
This works ok most of the time but we have been getting occasional BUS
signals, resulting in core dump, when reading files. This apparently occurs
because the requested file changes between it being mmap'd and the memcpy. 

A test program was written to simulate this, where a large file was was
mmap'd the program sleeps for 20 seconds during which time the file is
changed using date file. After the 20 seconds expires memcpy is called,
which then causes the SIGBUS. This happens on both local UFS file systems
and over NFS.

I would like to continue using mmap because of the apparent performance
benefits it brings but I'd also like to stop these occasional core dumps. A
couple of suggestions involving patches to the Apache source have been made
to me:

 - stat the file before mmap and memcpy and compare for differences and if
different remap the file, 
 - trap SIGBUS, warn and retry.

Do these sound reasonable, or is there a better way to fix work around this
problem?

httpd -V, the entry from the error log and a stack trace are below.

matt$ /opt/NTLIapache/bin/httpd -V
Server version: Apache/1.3.34 (Unix)
Server built:   Jan 10 2006 11:10:09
Server's Module Magic Number: 19990320:18
Server compiled with
 -D HAVE_MMAP
 -D USE_MMAP_SCOREBOARD
 -D USE_MMAP_FILES
 -D HAVE_FCNTL_SERIALIZED_ACCEPT
 -D HAVE_SYSVSEM_SERIALIZED_ACCEPT
 -D HAVE_PTHREAD_SERIALIZED_ACCEPT
 -D DYNAMIC_MODULE_LIMIT=64
 -D HARD_SERVER_LIMIT=2048
 -D HTTPD_ROOT=/opt/NTLIapache
 -D SUEXEC_BIN=/opt/NTLIapache/bin/suexec
 -D DEFAULT_PIDLOG=/var/opt/NTLIapache/logs/httpd.pid
 -D DEFAULT_SCOREBOARD=/var/opt/NTLIapache/logs/httpd.scoreboard
 -D DEFAULT_LOCKFILE=/var/opt/NTLIapache/logs/httpd.lock
 -D DEFAULT_ERRORLOG=/var/opt/NTLIapache/logs/error_log
 -D TYPES_CONFIG_FILE=/etc/opt/NTLIapache/mime.types
 -D SERVER_CONFIG_FILE=/etc/opt/NTLIapache/httpd.conf
 -D ACCESS_CONFIG_FILE=/etc/opt/NTLIapache/access.conf
 -D RESOURCE_CONFIG_FILE=/etc/opt/NTLIapache/srm.conf


Apache log entry:
[Thu Jan 19 16:29:26 2006] [notice] child pid 4316 exit signal Bus Error
(10), possible coredump in /opt/NTLIapache


Mdb stack trace (from $c):
libc_psr.so.1`memcpy+0x168(bb7a0, febf, 246, 20, 14cb7a0, bb7a0)
ap_bwrite+0x1e8(a18a0, febf, 266, 1000, 0, 2c400)
ap_send_mmap+0x74(febf, bd6d8, 0, 266, 0, 0)
default_handler+0x404(bd6d8, 0, 0, 8fed0, febf, 81a4)
ap_invoke_handler+0x178(bd6d8, 9f92c, be968, be968, 1f4, 8f400)
process_request_internal+0x7e4(0, a5960, bd6d8, a4f98, a5028, 8f000)
ap_process_request+0x24(bd6d8, 4, bd6d8, 5, c8, 1)
child_main+0x680(bc698, a18a0, 8f400, 8d800, 2dc00, 8f400)
standalone_main+0x14e0(180, f60, 7, 92258, ffbffaf4, 4)
main+0x334(87800, 8f800, 878a4, 1, 1, 2)
_start+0x108(0, 0, 0, 0, 0, 0)


Thanks,

Matt





-
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: [EMAIL PROTECTED]
  from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]