You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Justin Erenkrantz <je...@apache.org> on 2002/05/10 17:47:08 UTC

Changing files segfault?

I think we've seen a segfault on daedalus that can be tracked
down to the fact that the file changes on disk while we
serve the page.  So, at the start of the request, we see that
it is X bytes, but when we serve the request via sendfile, it
is changed to Y bytes.

IIRC, FreeBSD is returning EAGAIN from sendfile() in this case -
thats not terribly helpful.  

Uh, what can we do?  -- justin

(debug_finfo is added by gregames's patch to try to catch this
condition.  This is captured right before the assert(0) -
f->r->finfo represents the information retrieved at the beginning
of the request.)
(gdb) print debug_finfo
$1 = {pool = 0x8154010, valid = 7598448, protection = 1604, 
  filetype = APR_REG, user = 1134, group = 5007, inode = 2055478, 
  device = 134412, nlink = 1, size = 81920, csize = 581763456366018573, 
  atime = 1020755764000000, mtime = 1020757320000000, 
  ctime = 1020757320000000, 
  fname = 0x815a8b0 "/www/www.apache.org/dist/httpd/binaries/win32/apache_2.0.36-win32-x86-no_ssl.msi", name = 0x8090044 "ð\b\t\b", filehand = 0x812d120}

(gdb) print f->r->finfo
$2 = {pool = 0x8154010, valid = 7598448, protection = 1604, 
  filetype = APR_REG, user = 1134, group = 5007, inode = 2055478, 
  device = 134412, nlink = 1, size = 3173888, csize = 0, 
  atime = 1020755764000000, mtime = 1020755806000000, 
  ctime = 1020755806000000, 
  fname = 0x81553b0 "/www/www.apache.org/dist/httpd/binaries/win32/apache_2.0.36-win32-x86-no_ssl.msi", name = 0x0, filehand = 0x0}

(Note the times)
jerenkrantz@daedalus% ls -l httpd.core.1            /usr/local/apache/corefiles
-rw-r--r--  1 nobody  wheel  1609728 May  7 00:42 httpd.core.1
jerenkrantz@daedalus% ls -l /www/www.apache.org/dist/httpd/binaries/win32/apache_2.0.36-win32-x86-no_ssl.msi    
-rw-rw-r--  1 wrowe  httpd  3173888 May  7 00:42 /www/www.apache.org/dist/httpd/binaries/win32/apache_2.0.36-win32-x86-no_ssl.msi


Re: Changing files segfault?

Posted by Jeff Trawick <tr...@attglobal.net>.
Justin Erenkrantz <je...@apache.org> writes:

> I think we've seen a segfault on daedalus that can be tracked
> down to the fact that the file changes on disk while we
> serve the page.  So, at the start of the request, we see that
> it is X bytes, but when we serve the request via sendfile, it
> is changed to Y bytes.
> 
> IIRC, FreeBSD is returning EAGAIN from sendfile() in this case -
> thats not terribly helpful.  

Neither FreeBSD nor Linux sendfile() fail a call to start sending at a
bogus offset.  Apparently this is part of the normal Unix semantics
for seek-type operations.

> Uh, what can we do?  -- justin

Greg and I chatted about this before he put the last patch on to find
out for sure whether it was a changing file or bucket bogosity (bad
offset) causing the problem.

I think we have to trigger an error that (a) causes the connection to
end and (b) causes an error status to be recorded.  It would be nice
if apr_sendfile() could detect that something bogus happened* and
return an error, but I don't know if that is practical.

*(kernel send[_]file() said everything was cool but it didn't send any
bytes

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...