[SOLVED] Internal Server Error... Host says "too many concurrent processes"

accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sat, 2012-03-31 02:48

Unfortunately I can't get into my gallery at all right now so I can't give much system information. I have just upgraded to the most recent G2 version though. The gallery is at: http://www.accphotography.com/gallery

Lately when I've been uploading photos I've run into some issues with my gallery just crashing. Usually I give it a couple hours and it comes back with no problem. Last night I uploaded some photos, it went down and it never came back. I was getting a 500 Internal Server Error. I checked everything I could think of and found no problems. I contacted my host and was told:

Quote:
Our servers have a limit of 50 processes which includes simultaneously running php and cgi scripts, as well as cron jobs and shell sessions. You are exceeding that.
Whenever you exceed that it gives the 500 error.

Why is this happening? It's not happening in any other area of my site, only Gallery. It had not ever happened before last night and now I can't get into the gallery at all because of it. Is it possible something is faulty within the gallery that is causing too many processes to run? Do I just have too many photos or too much activity and that is the cause?

If this is something I can't get around, does anyone know of other hosts that allow larger limits?

I would love to upgrade to G3 but I can't even get into the site to do anything at all. I can't even disable modules, etc. to attempt to free up processes.

Right now I'm not getting the 500 error, I'm getting this error:

Quote:
An error has occurred while interacting with the database.
The exact nature of database errors is not captured unless Gallery debug mode is enabled in config.php. Before seeking support for this error please enable buffered debug output and retry the operation. Look near the bottom of the lengthy debug output to find error details.

Back to the Gallery
Error Detail -
Error (ERROR_STORAGE_FAILURE)

in modules/core/classes/GalleryStorage.class at line 719 (GalleryCoreApi::error)
in modules/core/classes/GalleryCoreApi.class at line 2885 (GalleryStorage::updateMapEntry)
in modules/core/classes/helpers/GalleryItemAttributesHelper_simple.class at line 89 (GalleryCoreApi::updateMapEntry)
in modules/core/classes/GalleryCoreApi.class at line 1303 (GalleryItemAttributesHelper_simple::incrementViewCount)
in modules/core/ShowItem.inc at line 93 (GalleryCoreApi::incrementItemViewCount)
in modules/core/classes/GalleryView.class at line 293 (ShowItemView::loadTemplate)
in main.php at line 465 (GalleryView::doLoadTemplate)
in main.php at line 104
in main.php at line 88

System Information
Gallery version 2.3.1
PHP version 5.3.10 cgi-fcgi
Webserver Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Database mysqli 5.0.95-community
Toolkits ImageMagick
Operating system Linux helix.hostmds.com 2.6.18-374.12.1.el5.lve0.8.54PAE #1 SMP Wed Jan 4 19:42:48 EET 2012 i686
Browser Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0

Can anyone help me with this? I am desperate. I have several major shoots I need to upload and clients are getting antsy.

Thank you!

Audrey

 
accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sat, 2012-03-31 03:10

I just put it into debug mode (had to learn how to do that as I've never needed it before) and I'm not sure if you can see the results or not but here is what it gave me:

Quote:
Smarty Debug Console
included templates & config files (load time in seconds)
themes/matrix/templates/error.tpl (0.03110) (total)
modules/core/templates/ErrorPage.tpl (0.00115)
assigned template variables
{$ErrorPage} Array (12)
isAdmin => true
stackTrace => "Error (ERROR_STORAGE_FAILURE)<ul><li..."
code => Array (1)
storageFailure => true
phpversion => "5.3.10"
php_uname => "Linux helix.hostmds.com 2.6.18-374.12..."
php_sapi_name => "cgi-fcgi"
webserver => "Apache/2.2.22 (Unix) mod_ssl/2.2.22 O..."
browser => "Mozilla/5.0 (Windows NT 6.1; WOW64; r..."
dbType => "mysqli"
dbVersion => "5.0.95-community"
toolkits => "ImageMagick"
version => "2.3.1"
{$SCRIPT_NAME} "/gallery/main.php"
{$_debug_config_keys} Array (2)
0 => "files"
1 => "vars"
{$_debug_config_vals} Array (2)
0 => Array (0)
1 => Array (0)
{$_debug_keys} Array (5)
0 => "ErrorPage"
1 => "SCRIPT_NAME"
2 => "head"
3 => "l10Domain"
4 => "theme"
{$_debug_tpls} Array (2)
0 => Array (3)
type => "template"
filename => "themes/matrix/templates/error.tpl"
depth => 0
1 => Array (4)
type => "template"
filename => "modules/core/templates/ErrorPage.tpl"
depth => 1
exec_time => 0.001154899597168
{$_debug_vals} Array (5)
0 => Array (12)
isAdmin => true
stackTrace => "Error (ERROR_STORAGE_FAILURE)<ul><li..."
code => Array (1)
storageFailure => true
phpversion => "5.3.10"
php_uname => "Linux helix.hostmds.com 2.6.18-374.12..."
php_sapi_name => "cgi-fcgi"
webserver => "Apache/2.2.22 (Unix) mod_ssl/2.2.22 O..."
browser => "Mozilla/5.0 (Windows NT 6.1; WOW64; r..."
dbType => "mysqli"
dbVersion => "5.0.95-community"
toolkits => "ImageMagick"
version => "2.3.1"
1 => "/gallery/main.php"
2 => Array (5)
tpl => Array (0)
style => Array (0)
javascript => Array (1)
lib/javascript/BlockToggle.js => true
meta => Array (0)
link => Array (0)
3 => "themes_matrix"
4 => Array (2)
pageType => "error"
errorTemplate => "modules/core/templates/ErrorPage.tpl"
{$debug_output} "<!DOCTYPE html PUBLIC "-//W3C//DTD XH..."
{$head} Array (5)
tpl => Array (0)
style => Array (0)
javascript => Array (1)
lib/javascript/BlockToggle.js => true
meta => Array (0)
link => Array (0)
{$l10Domain} "themes_matrix"
{$theme} Array (2)
pageType => "error"
errorTemplate => "modules/core/templates/ErrorPage.tpl"
assigned config file variables (outer template scope)
{#files#} Array (0)
{#vars#} Array (0)

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2012-03-31 06:59

You say this issue had not happened before but didn't say when the host imposed this 50 process limit. Also is it 50 processes just for you or 50 processes for all such processes on the server across all accounts?

As to why it is not affecting other parts of your site, well these are semi-static pages (shtml - they should be purely static and use html but that's another issue) G2, and so will G3, run php scripts and need to access a database. That process is what your host is clamping down on. They appear to basically only want light websites, preferably only running static pages.

On the debug, you need the debug output that comes on the page (not the one from the smarty debug console). See here instead.
The output can be rather long so do not paste it directly in your post. Either put it in a text file and attach or use a paste bin and post a link. A popular paste bin is at pastebin.com.

However, I think that while we certainly could spend time trying to get to the bottom of this issue etc, if your host is shutting your processes down, and your site has commercial value, you should be looking at switching to a more capable setup. There is not likely to be any switch that can be flipped to make it your G2, and I'll wager, probably any other PHP application such as G3, work on your current server.

In summary, I am afraid it is time to change hosts. Go to webhostingtalk.com for recommendations.

--
dakanji.com

 
accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sat, 2012-03-31 16:54

Thank you VERY much for your reply!!

I'm attaching what I think you need as far as the debug. I hope that's the right one. It's not very long at all actually.

Ok. I see what you're saying, but I don't think that's actually the case here. Please understand I respect your knowledge and advice and I'm not trying to challenge you, I'm just seeing something odd I can't explain.

I was able to find a log file on my cPanel for the times that my site has exceeded the processes. Guess what? It has only ever happened in all my years with them about 5 times before Thursday night. Since Thursday night it has been happening non stop. There was a graph and a VERY obvious spike in Thursday night that has not dropped off. I went back and looked at the 5 or so prior times it happened... every single time I tried to upload photos. I was trying to upload photos when it went down Thursday night as well. Something is happening in the upload process that is locking things down. I've been struggling to upload the last several sessions for a few months now and usually am able to coax it to work with patience, but I can see why I always have trouble, it's topping out my processes. I also see why it normally resolves itself (when things are done, the processes go down, they restore the site). But now it's like it's locked into upload mode or something as the processes won't go down. Except for those 5 times and since Friday night I have NEVER exceeded 10 processes, now I am well over 50. Interestingly this all happened when I changed computers a few months back as I was unable to install the Windows Gallery Remote program and now have to use the Applet. It started when that happened.

So, somewhere there is a bug with my gallery and uploading, or the remote applet, or something. It's very clear by the logs this is a very recent change.

Any clues whatsoever what this could be? If I must I may have to uninstall G2 altogether and reinstall it if there's a bug in my code or something.

Thank you very, very much for your help!!

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2012-03-31 19:27

The pertinent error in that debug log is "1205: Lock wait timeout exceeded; try restarting transaction".

This is controlled by a MySQL parameter set by the host. In simple terms, it is how long the database will sit around in a locked state while waiting for a transaction to be completed.

Options are:

1. Change the G2 code to release locks frequently and to break up uploads into smaller batches. I believe it does them in batches of 100 or so but I am not sure and do not know if it releases locks and re-establishes them in between. There is an update effort on G2 going on and this will be looked into but will take some time if ever.

2. Open a support ticket with your host and ask them to increase the MySQL "TransactionDeadlockDetectionTimeout" setting. Long shot but worth a try.

3. Manually break up your uploads into smaller batches or use the zip upload facility.

The 50 process answer, which flat didn't make much sense, you got from your host is a typical support request response from certain types of hosts. Say anything to push the problem away.

--
dakanji.com

 
accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sun, 2012-04-01 04:18

Oh brilliant Dayo!! Thank you so very much!!!

 
accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sun, 2012-04-01 05:28

Hey Dayo! Apparently the server resets things when the month turns over as everything just suddenly freed up at midnight!! The gallery opens fully now.

Interestingly, the debug report got MUCH, much longer. I'm attaching it again. Can you tell me if there is anything of obvious/serious note here?

Thanks again!!

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sun, 2012-04-01 16:27

Yes. For some reason, this query "SELECT g_itemId FROM g2_FavouritesMap WHERE g_userId=6" is being run over and over and over again and similarly, the G2 core seems to be loading over and over and over again.

Seems almost like there is a runaway script and now my sympathy is with the host.

Do you have some sort of favourites module or something similar? I'll consider disabling it.

In your shoes, I'll go over the installation and remove all unnecessary modules.

--
dakanji.com

 
accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sun, 2012-04-01 20:38

Dayo, you're a genius. I uninstalled the module, ran a few maintenance tasks (that wouldn't even run before), deleted a few pics, uploaded a few pics and everything works PERFECTLY. I can't even begin to thank you enough. You rock!!!

Now I wonder why that module got corrupted. It worked for years. LOL

Thank you!!!! I'm sure my host thanks you very much as well!!!

 
accphotography

Joined: 2008-05-14
Posts: 66
Posted: Sun, 2012-04-01 20:43

Oh another note, any idea why I get this when I try to run a rebuild resizes/thumbnails?

Quote:
Last Run Details:

Error (ERROR_MISSING_OBJECT) : Missing object for 43718

in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 2054 (GalleryCoreApi::error)
in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 98 (GalleryStorageExtras::_identifyEntities)
in modules/core/classes/GalleryStorage.class at line 314 (GalleryStorageExtras::loadEntities)
in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 71 (GalleryStorage::loadEntities)
in modules/core/classes/GalleryCoreApi.class at line 2361 (GalleryEntityHelper_simple::loadEntitiesById)
in modules/core/classes/BuildDerivativesTask.class at line 133 (GalleryCoreApi::loadEntitiesById)
in modules/core/AdminMaintenance.inc at line 128 (BuildDerivativesTask::run)
in ??? at line 0 (AdminMaintenanceController::runTask)
in modules/core/classes/GalleryTemplateAdapter.class at line 1089
in /home/accpycom/10271112/datkeep2688/smarty/templates_c/%%381295543/matrix/%%3A^3A8^3A818B59%%theme.tpl.php at line 75 (GalleryTemplateAdapter::trailer)
in lib/smarty/Smarty.class.php at line 1255
in modules/core/classes/GallerySmarty.class at line 61 (Smarty::fetch)
in modules/core/classes/GalleryTemplate.class at line 241 (GallerySmarty::fetch)
in main.php at line 506 (GalleryTemplate::display)
in main.php at line 104
in main.php at line 88

Thanks again!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2012-04-01 21:35