Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache/PHP hangs on POST/submit form
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
selig
Guru
Guru


Joined: 31 Jul 2005
Posts: 425
Location: Prague, Czech Republic

PostPosted: Fri Dec 21, 2012 2:04 pm    Post subject: Apache/PHP hangs on POST/submit form Reply with quote

I have been having this problem for months. I have a webhosting server and from time to time, every submit of any PHP form hangs. There are no errors in the log and I have updated all packages over the previous months. I even created a brand new chroot with all packages compiled from scratch and installed a new kernel but nothing helps. It seems random, sometimes the server can last for a couple of weeks without any problem but then there are days when it happens several times. It used to be worse when I had the worker MPM, I have switched to prefork in the meantime. That helped a bit but did not solve the problem. I have also tried decreasing the max requests per child directive, in hopes that if PHP leaks or hangs, the process will get restarted more frequently, solving the problem. But it did not really help either.

Now I do not know what else to try or where to look. Any ideas would be appreciated.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Fri Dec 21, 2012 2:25 pm    Post subject: Reply with quote

What kind of webhosting server? Shared, virtual private or rented hardware? I assume the server OS is Gentoo, since you're posting here.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
selig
Guru
Guru


Joined: 31 Jul 2005
Posts: 425
Location: Prague, Czech Republic

PostPosted: Sat Dec 22, 2012 8:55 pm    Post subject: Reply with quote

It is my own hardware, nothing virtual.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Sat Dec 22, 2012 9:15 pm    Post subject: Reply with quote

Can you post:

emerge --info

emerge -pv apache

emerge -pv php

?
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
selig
Guru
Guru


Joined: 31 Jul 2005
Posts: 425
Location: Prague, Czech Republic

PostPosted: Sat Dec 29, 2012 10:47 am    Post subject: Reply with quote

emerge --info:
Code:

Portage 2.1.10.65 (unavailable, gcc-4.5.3, glibc-2.14.1-r3, 3.0.4-hr5 x86_64)                                                                                                       
=================================================================                                                                                                                   
System uname: Linux-3.0.4-hr5-x86_64-Intel-R-_Xeon-R-_CPU_E5520_@_2.27GHz-with-gentoo-2.0.3                                                                                         
Timestamp of tree: Unknown                                                                                                                                                         
dev-lang/python:          2.7.2-r3::gentoo, 3.2.2::gentoo                                                                                                                           
sys-devel/autoconf:       2.68::gentoo                                                                                                                                             
sys-devel/automake:       1.11.1::gentoo                                                                                                                                           
sys-devel/binutils:       2.21.1-r1::gentoo                                                                                                                                         
sys-devel/libtool:        2.4-r1::gentoo                                                                                                                                           
sys-kernel/linux-headers: 3.1::gentoo (virtual/os-headers)                                                                                                                         
Repositories: x-portage                                                                                                                                                             
ACCEPT_LICENSE="* -@EULA"                                                                                                                                                           
CFLAGS="-O2 -mtune=core2 -march=core2 -pipe -fforce-addr"                                                                                                                           
CHOST="x86_64-pc-linux-gnu"                                                                                                                                                         
CONFIG_PROTECT="/etc /var/qmail/alias /var/qmail/control /var/vpopmail/domains /var/vpopmail/etc"                                                                                   
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"                                                                                                               
CXXFLAGS="-O2 -mtune=core2 -march=core2 -pipe -fforce-addr"                                                                                                                         
DISTDIR="/usr/portage/distfiles"                                                                                                                                                   
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"                                                                                                                         
GENTOO_MIRRORS="ftp://ftp.fi.muni.cz/pub/linux/gentoo/"                                                                                                                             
PKGDIR="/usr/portage/packages"                                                                                                                                                     
PORTAGE_TMPDIR="/var/tmp"                                                                                                                                                           
PORTDIR="/usr/portage"                                                                                                                                                             
PORTDIR_OVERLAY=""                                                                                                                                                                 
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"                                                                                                                               
USE="apache2 berkdb bzip2 caps clamav curl expat fam fontconfig ftp gd gdbm geoip gs iconv imap ithreads jpeg jpeg2k lm_sensors logrotate memlimit mmx mysql mysqli ncurses perl perlsuid php pic png python slang spell sse sse2 threads tiff truetype xml"
Unset:  ACCEPT_KEYWORDS, EMERGE_DEFAULT_OPTS, PORTAGE_BUNZIP2_COMMAND



emerge -pv apache:
Code:

[ebuild     U  ] app-admin/apache-tools-2.2.23 [2.2.22] USE="ssl" 5,357 kB
[ebuild     U  ] www-servers/apache-2.2.23 [2.2.22-r1] USE="ssl suexec -debug -doc -ldap (-selinux) -static -threads" APACHE2_MODULES="actions alias auth_basic auth_digest authn_alias authn_dbd authn_default authn_file authz_default authz_groupfile authz_host authz_owner authz_user cgid dbd deflate dir env expires ext_filter filter headers ident imagemap include log_config mime mime_magic negotiation rewrite setenvif status vhost_alias -asis -authn_anon -authn_dbm -authz_dbm -autoindex -cache -cern_meta -cgi -charset_lite -dav -dav_fs -dav_lock -disk_cache -dumpio -file_cache -info -log_forensic -logio -mem_cache -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -proxy_scgi -reqtimeout -speling -substitute -unique_id -userdir -usertrack -version" APACHE2_MPMS="prefork -event -itk -peruser -worker" 63 kB



emerge -pv php:
Code:

[ebuild  NS    ] dev-lang/php-5.4.6 [5.3.11] USE="apache2 berkdb bzip2 calendar cjk cli crypt ctype curl fileinfo filter ftp gd gdbm hash iconv imap ipv6 json mhash mysql mysqli nls pdo phar pic posix readline session simplexml soap spell ssl tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter xsl zip zlib -bcmath -cdb -cgi -curlwrappers -debug -doc -embed -enchant -exif -firebird -flatfile -fpm (-frontbase) -gmp -inifile -intl -iodbc -kerberos (-kolab) -ldap -ldap-sasl -libedit -mssql -mysqlnd -oci8-instant-client -odbc -pcntl -postgres -qdbm -recode -sharedmem -snmp -sockets -sqlite3 (-sybase-ct) -sysvipc -threads -tidy -wddx -xpm" 10,774 kB



Also I found out that very simple PHP scripts do not hang on POST - but when it comes to opening wordpress sites or sending some support tickets, etc., it becomes very slow - top shows nothing, Apache seems to be sleeping and not using CPU at all.

When I check the log while it is stalling, it shows nothing. The corresponding line in the log appears only after the page has been successfully downloaded but it shows the correct time (when I sent the request).
Back to top
View user's profile Send private message
lxg
Veteran
Veteran


Joined: 12 Nov 2005
Posts: 1019
Location: Aachen, Germany

PostPosted: Sat Dec 29, 2012 12:19 pm    Post subject: Reply with quote

Is it possible that the bottleneck is your MySQL server? For example it might be that slow queries on a large data basis cause MySQL to have too many open connections, and (depending on its configuration) it waits until a new slot is available.

What types of PHP applications do you have installed? In your WordPress installation(s), what plugins do you use? Did you try deactivating them? Sometimes they are horribly coded and cause the weirdest problems.
_________________
lxg.de – codebits and tech talk
Back to top
View user's profile Send private message
selig
Guru
Guru


Joined: 31 Jul 2005
Posts: 425
Location: Prague, Czech Republic

PostPosted: Sun Dec 30, 2012 3:38 pm    Post subject: Reply with quote

MySQL is not the bottleneck, it is not doing anything when this problem occurs. Also, there are not many open connections to the database.

The biggest problem is that it is a webhosting server and I have no control over what my customers are using. I cannot just go and disable some wordpress plugins in their installation. Unfortunately, this makes it really difficult to trace the root of the problem. I am quite sure that something must trigger it, some weird PHP script one of my customers is using, a wordpress plugin, something like that. On the other hand, since I am using apache/prefork, the processes should be isolated and even if one of them slows down, the rest should work normally.
Back to top
View user's profile Send private message
lxg
Veteran
Veteran


Joined: 12 Nov 2005
Posts: 1019
Location: Aachen, Germany

PostPosted: Sun Dec 30, 2012 4:01 pm    Post subject: Reply with quote

selig wrote:
The biggest problem is that it is a webhosting server and I have no control over what my customers are using.


Yup, what you're experiencing are the common problems of a virtual hosting provider. Unless you're offering real virtualization and resource provisioning, one customer can drag the entire server down.

Are you using Munin? If not, you should really consider installing it. If you already have it, I would recommend to assign virtual identifiers to your customers and monitor their ressource usage. For example, as for Apache, you could set up virtual, internal IP addresses (one for each vHost) and assign a Munin sensor to each of them. I think there are Munin plugins to monitor virtual hosts directly, but I don't know how they perform. Same for MySQL etc. You can even write your own sensors, it's not that hard.
_________________
lxg.de – codebits and tech talk
Back to top
View user's profile Send private message
selig
Guru
Guru


Joined: 31 Jul 2005
Posts: 425
Location: Prague, Czech Republic

PostPosted: Thu Jan 03, 2013 12:56 pm    Post subject: Reply with quote

Thanks for the tip, I will try Munin and see what it can tell me.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum