Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Apache/PHP hangs on POST/submit form

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
selig
Guru
Guru
User avatar
Posts: 425
Joined: Sun Jul 31, 2005 4:58 pm
Location: Prague, Czech Republic

Apache/PHP hangs on POST/submit form

  • Quote

Post by selig » Fri Dec 21, 2012 2:04 pm

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.
Top
audiodef
Watchman
Watchman
User avatar
Posts: 6656
Joined: Wed Jul 06, 2005 1:02 pm
Location: The soundosphere
Contact:
Contact audiodef
Website

  • Quote

Post by audiodef » Fri Dec 21, 2012 2:25 pm

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
Top
selig
Guru
Guru
User avatar
Posts: 425
Joined: Sun Jul 31, 2005 4:58 pm
Location: Prague, Czech Republic

  • Quote

Post by selig » Sat Dec 22, 2012 8:55 pm

It is my own hardware, nothing virtual.
Top
audiodef
Watchman
Watchman
User avatar
Posts: 6656
Joined: Wed Jul 06, 2005 1:02 pm
Location: The soundosphere
Contact:
Contact audiodef
Website

  • Quote

Post by audiodef » Sat Dec 22, 2012 9:15 pm

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
Top
selig
Guru
Guru
User avatar
Posts: 425
Joined: Sun Jul 31, 2005 4:58 pm
Location: Prague, Czech Republic

  • Quote

Post by selig » Sat Dec 29, 2012 10:47 am

emerge --info:

Code: Select all

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: Select all

[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: Select all

[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).
Top
lxg
Veteran
Veteran
User avatar
Posts: 1019
Joined: Sat Nov 12, 2005 3:12 pm
Location: Aachen, Germany
Contact:
Contact lxg
Website

  • Quote

Post by lxg » Sat Dec 29, 2012 12:19 pm

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
Top
selig
Guru
Guru
User avatar
Posts: 425
Joined: Sun Jul 31, 2005 4:58 pm
Location: Prague, Czech Republic

  • Quote

Post by selig » Sun Dec 30, 2012 3:38 pm

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.
Top
lxg
Veteran
Veteran
User avatar
Posts: 1019
Joined: Sat Nov 12, 2005 3:12 pm
Location: Aachen, Germany
Contact:
Contact lxg
Website

  • Quote

Post by lxg » Sun Dec 30, 2012 4:01 pm

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
Top
selig
Guru
Guru
User avatar
Posts: 425
Joined: Sun Jul 31, 2005 4:58 pm
Location: Prague, Czech Republic

  • Quote

Post by selig » Thu Jan 03, 2013 12:56 pm

Thanks for the tip, I will try Munin and see what it can tell me.
Top
Post Reply

9 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic