Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270820 - www-servers/apache-2.2.11 with USE="threads" hang net-misc/dhcp-3.1.1
Summary: www-servers/apache-2.2.11 with USE="threads" hang net-misc/dhcp-3.1.1
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-22 12:30 UTC by Evgeniy
Modified: 2010-03-05 08:58 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
ps aux output (process-list.txt,9.62 KB, text/plain)
2009-05-29 08:45 UTC, Evgeniy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy 2009-05-22 12:30:07 UTC
when apache execute php script like this:
<?
$command="sudo /etc/init.d/dhcpd restart";
$success = exec($command, $out, $exit_code);
foreach($out as $outs)
echo $outs."\n";

echo $exit_code."\n";
?>

dhcp server after restart does not respond, and can be killed only with "kill -s 9 pid", sometimes dhcpd start listen socket 443 instead of apache.

Reproducible: Always

Steps to Reproduce:
1.emerge www-servers/apache-2.2.11 with USE="threads" and dev-lang/php-5.2.9-r2
2.emerge net-misc/dhcp-3.1.1
3.place script listed in "description" in DocumentRoot, for example in script.php file and run it by open http://server.name/script.php, first time it reboot dhcpd correctly, but after reboot dhcpd will hang :(

Actual Results:  
dhcpd hangs and /etc/init.d/dhcpd restart or stop, does not stop it, sometimes dhcpd start listen port 443. Only one way to stop dhcpd is kill it with signal KILL


Expected Results:  
Restart dhcpd from php script. 
When I don't use USE="threads", it works fine, and for example "/etc/init.d/named restart" work fine in all cases.

Sorry for my bad english :))

Bug reproduced in hardened and normal kernels, in chrooted and not chrooted dhcp
On two different hosts

=======HARDENED emerge --info  =============
Portage 2.1.6.11 (hardened/linux/x86/2008.0, gcc-3.4.6, glibc-2.8_p20080602-r1, 2.6.27-hardened-r8 i686)
=================================================================                                       
System uname: Linux-2.6.27-hardened-r8-i686-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4400+-with-glibc2.3.2
Timestamp of tree: Thu, 21 May 2009 19:45:01 +0000                                                        
distcc 3.1 i686-pc-linux-gnu [enabled]                                                                    
app-shells/bash:     3.2_p39                                                                              
dev-lang/python:     2.4.4-r6, 2.5.4-r2                                                                   
dev-python/pycrypto: 2.0.1-r6                                                                             
sys-apps/baselayout: 1.12.11.1                                                                            
sys-apps/sandbox:    1.6-r2                                                                               
sys-devel/autoconf:  2.63                                                                                 
sys-devel/automake:  1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distcc distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.inode.at/ http://gentoo.kiev.ua/ftp/ "
LDFLAGS="-Wl,-O1"
LINGUAS="en ru"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="acl apache2 bzip2 cli cracklib crypt dri gdbm hal hardened iconv mbox milter mudflap mysql ncurses nls nptl nptlonly pam pcre perl pic python radius readline sendmail session smp snmp sockets spl sse sse2 ssl sysfs tcpd threads unicode urandom vhosts x86 zlib" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LINGUAS="en ru" USERLAND="GNU" VIDEO_CARDS="vga vesa"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY


======== Normal kernel emerge --info   ====================
Portage 2.1.6.13 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.9_p20081201-r2, 2.6.28-gentoo-r5 i686)                      
=================================================================                                                          
System uname: Linux-2.6.28-gentoo-r5-i686-AMD_Athlon-tm-_64_Processor_3000+-with-gentoo-2.0.0                              
Timestamp of tree: Fri, 22 May 2009 07:00:01 +0000                                                                         
app-shells/bash:     4.0_p17-r1                                                                                            
dev-lang/python:     2.4.4-r13, 2.6.2                                                                                      
dev-python/pycrypto: 2.0.1-r8                                                                                              
dev-util/cmake:      2.6.4                                                                                                 
sys-apps/baselayout: 2.0.0                                                                                                 
sys-apps/openrc:     0.4.3-r2                                                                                              
sys-apps/sandbox:    1.9                                                                                                   
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.29
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.inode.at"
LDFLAGS="-Wl,-O1"
LINGUAS="en ru"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl berkdb bzip2 cli cracklib crypt cups dbus dri fortran gdbm gpm iconv isdnlog kde kde4 midi mng mudflap mysql ncurses nls nptl nptlonly opengl openmp pam pcre perl pppd python qt4 readline reflection session spl ssl svg sysfs tcpd threads unicode webkit x86 xorg zlib" ALSA_CARDS="hda-intel" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LINGUAS="en ru" USERLAND="GNU" VIDEO_CARDS="nv"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Mike Auty (RETIRED) gentoo-dev 2009-05-25 15:24:56 UTC
Hi Evgeniy, that's quite a complex set of circumstances you've got there.  5:)

It would be useful to try a few things to try and figure out which program's at fault.

Could you please reboot the machine (or get it to a point where dhcpd will start and stop fine using /etc/init.d/dhcpcd) then run your php script once?

After that, please run "ps aux > process-list.txt" and then attach the process-list.txt file to this bug.  That should show us what processes are still running, which user they're running as and what state they're in...

Also could you tell us whether this problem occurs when apache is compiled with USE="threads" but when php has USE="-threads"?
Comment 2 Evgeniy 2009-05-28 15:07:22 UTC
Ok, I will do all that you ask. About php, it won't merge without "threads", prints:

* You need to enable USE flag 'threads' to build a thread-safe version
* of dev-lang/php for use with www-servers/apache" 

And I think you can simply reproduce this bug, emerge apache with:

USE="ssl threads -debug -doc -ldap (-selinux) -sni -static -suexec" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker"


and php with

USE="apache2 bcmath berkdb bzip2 cli crypt gdbm iconv imap kerberos mysql ncurses nls pcre pic readline reflection session snmp sockets spl ssl sysvipc threads unicode xml zlib -adabas -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -hash -inifile -interbase -iodbc -ipv6 (-java-external) -json -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -posix -postgres -qdbm -recode -sapdb -sharedext -sharedmem -simplexml -soap -solid -spell -sqlite -suhosin -sybase -sybase-ct -tidy -tokenizer -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip (-zip-external)"

run apache and from http run php script like that:

<?
$command="sudo /etc/init.d/dhcpd restart";
$success = exec($command, $out, $exit_code);
?>

and that try "/etc/init.d/dhcpd stop". It will not stop :(  
and I think not only dhcpd will do that.

Please try it in your host
Comment 3 Evgeniy 2009-05-28 15:14:13 UTC
P.S. Some times "ss -pln" show:

0 128 *:80 *:* users:(("apache2",13864,4),("apache2",13870,4),("dhcpd",13898,4))

but not allways.

P.P.S. In all others case dhcpd WORK CORRECT.
Comment 4 Mike Auty (RETIRED) gentoo-dev 2009-05-28 19:03:30 UTC
I'm afraid I don't have a development machine I can spare to go installing apache and PHP (and they're not packages I maintain), so it would be really helpful if you could run the request test ("ps aux > process-list.txt") after you've run your php script on the system you have that's already experiencing the problem.

Also I'm unfamiliar with the ss command (is it an alias or an actual program) and so I don't know what information your second comment showed.
Comment 5 Evgeniy 2009-05-29 08:45:56 UTC
Created attachment 192826 [details]
ps aux output
Comment 6 Evgeniy 2009-05-29 08:52:56 UTC
process-list.txt - from my workstation, where I testing that bug, later I will attach process-list.txt from server host.


"ss" is a part of iproute2, its like unix netstat
"netstat -pln" in same case print:
tcp        0      0 0.0.0.0:443              0.0.0.0:*                  517/dhcpd

but it not always reproduced
Comment 7 Mike Auty (RETIRED) gentoo-dev 2009-05-29 09:25:50 UTC
Ok thanks, that didn't shed any light on the problem unfortunately, so I'm throwing it over to the PHP guys (with apache CCed) since it seems something they're most likely to have experience with.  They may well reassign it to the dhcp or base-system group if they find out it's something specific to dhcp or baselayout's init scripts.
Comment 8 Evgeniy 2009-06-05 09:45:37 UTC
Some new information about bug!
I think it in mod_php, today I run apache with php as cgi and all looks like fine!
I will continue testing it, but you please try fix it :)
Comment 9 Benedikt Böhm (RETIRED) gentoo-dev 2010-03-05 08:58:31 UTC
please reopen this bug if it is still an issue