I have 3 servers all set up identically load balancing a single site with apache, mod_proxy_fcgi, php5-fpm and mysql/mariaDB galera cluster running on ubuntu 14.04 server. Everything seams to work fine for the most part except one page. The page im having issues with uploads and processes a large csv file (between 7K and 20K lines) then inserts the data into the database. This page worked fine when the site was running on a single server but the additional time galera cluster takes to sync the other two servers seams to be the root cause of the problem as it is a synchronous update a lock is obtained and held until all 3 servers are updated. This is unnoticeable on any other page but in this script a 504 error is returned and the apache error log contains the following error.
[proxy_fcgi:error] [pid 24235] [client 99.99.99.99:44197] AH01068: Got bogus version 1,referer: http://example.com/page.php
[proxy_fcgi:error] [pid 24235] (22)Invalid argument: [client 99.99.99.99:44197] AH01075: Error dispatching request to :, referer: http://example.com/page.php
the 99.99.99.99 ip address is the actual ip address of the server not the client so it appears that php-fpm is not responding to proxy_fcgi in time (because it is waiting on mysql) and a timeout is returned. I have attempted to adjust the timeout in my apache site config as well as timeouts for php-fpm with no luck.
my apache config is as follows
<Proxy fcgi://127.0.0.1:9000>
ProxySet timeout=1800
</Proxy>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/$1
also tried
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/$1 connectiontimeout=300 timeout=300
I do not want to process the upload in the background because as i am processing the page if errors are found in the csv file i am using the mysql row pk to allow the user to edit information and correct the issues. My users are more comfortable waiting for this page then they are coming back later to check its progress.