Subject: pkg/35246: apr1 failure to use kqueue for apr_pollset_poll
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jeremias@optushome.com.au>
List: pkgsrc-bugs
Date: 12/13/2006 14:15:00
>Number:         35246
>Category:       pkg
>Synopsis:       pkgsrc/devel/apr1 kqueue does not work for netbsd
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 13 14:15:00 +0000 2006
>Originator:     jeremias@optushome.com.au
>Release:        NetBSD 3.99.21
>Organization:
	
>Environment:
	apache 2.2.3 ( from pkgsrc)
	apr 1  (which seems to be aliased to apache 2.2.3 )

	
	
System: NetBSD maggi 3.99.21 NetBSD 3.99.21 (NBX) #1: Sat Jul 22 16:52:00 EST 2006 root@maggi:/sys/src/sys/arch/i386/compile/NBX i386
Architecture: i386
Machine: i386
>Description:
	The problem showed when using apache 2.2.3 and the cgi-scripts did not show any output
	althought they executed properly.

	Traceing the problem revealed, that apache thinks it had a timeout out the stdout connection to the cgi script.

	Disabling kqueue in apr1 for netbsd seems to have fixed the problem

	It seems the same problem that darwin has is for this netbsd
	so diableing kqueue in apr fixes the problem for my netbsd kernel
	( I dunno if there is a kernel patch available for this, but 
	google did not show anything except for darwin )

>How-To-Repeat:
	accessing /cgi-bin/printenv does not work (http error),
	althought the script successfully executed.
	inserting a delay in the apache mog_cgi before the apr_poll get called
	(see in the fix section) helps

>Fix:

	disabling kqueue in apr1 for netbsd (as it is done for darwin)  seems to have fixed the problem

	diff -r ./work/httpd-2.2.3/srclib/apr/configure /sys/pkgsrc/www/apache22/work/httpd-2.2.3/srclib/apr/configure
	4378,4388d4377
	<  # See issue 34332
	< 
	<         # kqueue is broken on OS X, the poll tests work, but the socket tests
	<         # hang when it's turned on.  if you decide to reenable this please be
	<         # sure to test that ALL the tests continue to work with it turned on.
	< 
	<   if test -z "$ac_cv_func_kqueue"; then
	<     test "x$silent" != "xyes" && echo "  setting ac_cv_func_kqueue to \"no\""
	<     ac_cv_func_kqueue="no"
	<   fi
	< 


	Inserting the test below also fixes the problem, but.....

	diff -bcr ./work/httpd-2.2.3/modules/generators/mod_cgi.c /sys/pkgsrc/www/apache22/work/httpd-2.2.3/modules/generators/mod_cgi.c
	*** ./work/httpd-2.2.3/modules/generators/mod_cgi.c     Wed Jul 12 13:38:44 2006
	--- /sys/pkgsrc/www/apache22/work/httpd-2.2.3/modules/generators/mod_cgi.c      Wed Dec 13 23:44:23 2006
	***************
	*** 672,677 ****
	--- 672,681 ----
	  
		timeout = block == APR_NONBLOCK_READ ? 0 : data->r->server->timeout;
		  
		  + #if FIX_PROBLEM_EXECUTING_CGI_SCRIPTS_WITH_APR
		  +       ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, data->r,
		  +                               "Timeout set: %d",timeout);
		  + #endif
			do {
				  const apr_pollfd_t *results;
					    apr_int32_t num;
					    Only in /sys/pkgsrc/www/apache22/work/httpd-2.2.3/modules/generators: mod_cgi.lo


>Unformatted: