Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 May 2011 23:00:53 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        freebsd-apache@FreeBSD.org
Subject:   Interesting apache 2.2 + accept filter problem
Message-ID:  <4DDC9B15.2090703@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Howdy,

I have an odd one here, and I'm hoping to get some insight. I'm using 
apache 2.2 (latest ports version) along with the accf_http kernel module 
(which is loaded). If I start it the "normal" way, everything works just 
fine. However if I start it with -D FOREGROUND then I get the following 
error in httpd-error.log:

(22)Invalid argument: Failed to enable the 'httpready' Accept Filter

So I reduced everything down to a test case, and I can easily reproduce 
it with nothing but a clean ports install (minus SSL, which doesn't make 
a difference in the outcome, but simplified the ktrace).

I've run 'ktrace httpd' and 'ktrace httpd -D FOREGROUND' numerous times, 
and there is one very clear difference. The first, which works, looks 
like this:

  48226 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_REUSEADDR,0x7fffffffe80c,0x4)
  48226 initial thread RET   setsockopt 0
  48226 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_KEEPALIVE,0x7fffffffe80c,0x4)
  48226 initial thread RET   setsockopt 0
  48226 initial thread CALL  setsockopt(0x3,0x6,0x1,0x7fffffffe7ec,0x4)
  48226 initial thread RET   setsockopt 0
  48226 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_ACCEPTFILTER,0x7fffffffe6e0,0x100)
  48226 initial thread RET   setsockopt 0

The weird thing is that the second one, which produces the error, is 
exactly the same, except that there is one extra call at the end, which 
is the one that fails:

  48208 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_REUSEADDR,0x7fffffffe7ec,0x4)
  48208 initial thread RET   setsockopt 0
  48208 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_KEEPALIVE,0x7fffffffe7ec,0x4)
  48208 initial thread RET   setsockopt 0
  48208 initial thread CALL  setsockopt(0x3,0x6,0x1,0x7fffffffe7cc,0x4)
  48208 initial thread RET   setsockopt 0
  48208 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_ACCEPTFILTER,0x7fffffffe6c0,0x100)
  48208 initial thread RET   setsockopt 0
  48208 initial thread CALL 
setsockopt(0x3,SOL_SOCKET,SO_ACCEPTFILTER,0x7fffffffe6c0,0x100)
  48208 initial thread RET   setsockopt -1 errno 22 Invalid argument

I cannot figure out what it is about running in the foreground that is 
causing that last call, and I've run out of things to test or try, so 
I'm asking for help. Any ideas?

BTW, not sure it matters but the the reason that I want to add -D 
FOREGROUND is for use with daemontools. However I've managed to isolate 
the error to just 'httpd -D FOREGROUND' on the command line without 
anything else involved.


Thanks,

Doug

-- 

	Nothin' ever doesn't change, but nothin' changes much.
			-- OK Go

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DDC9B15.2090703>