Entire Web Server Hanging from CGI App

PS aux will tell you which processes run and how much resources cpu and memory they use.

It is also possible the virtual server has only one core. Given what you describe, I’d say that is probable.

OK - problem happened again.
While the server was frozen - I was able to PuTTY in and do a TOP command. Very little CPU usage reported; memory looked OK as well.

What else could hang a server?

if the CPU usage is low, it sounds like the server is NOT hung. What is it that’s actually happening (or not happening)?

A user of my CGI webapp will be working on the web app. At some point (so far I can not ID a consistent point) their session of the webapp will lock (no user response). At that point, if I go to my other webapps or my wordpress hosted sites on that same server - everything is non responsive. At the moment - the CGI webapp is by far the most active application on the server, and I have no evidence that any other activities on the other apps or sites have been touched.

non-responsive ? hung

OK - let’s call it non-responsive. Now what?

It could be that Apache is not configured to handle enough connections. I see that you checked errors_log, but have you checked access_log to see if there are connections coming in?

If there’s no activity there, have you looked at your firewall logs?

You may want to contact your VPS provider to see if another VPS on the same hardware as your VPS is having unusual load spikes.

OK - more data…
I was able to force the non-responsiveness by saturating the memory on the server (I have 1 GB available). It didn’t take too much effort. I Invoked just a few instances of one cgi app, and a couple more instances of another and launched a website. Utilization kept creeping upward - which is puzzling. I am not sure why it creeps when I stop invoking new processes.

There were a lot of httpd calls alive - each consuming 2% of memory. And from time to time php-cgi commands would show up - each consuming more than 5% of memory.

So - do I have a memory leak? What might cause that?

Continuing to gather data for troubleshooting - need some explanation if anyone can help…
Monitoring my server with SSH Top. Need to know what these command events mean in the SSH TOP list:

  1. php-cgi
  2. httpd
  3. MyApplicationName
  4. myapplicationname.cgi

[quote=104473:@Mark Pastor]Need to know what these command events mean in the SSH TOP list:

  1. php-cgi - This is a php script running through the PHP CGI interpreter. Probably Wordpress in your case.
  2. httpd - This is the Apache web server.
  3. MyApplicationName - Your XOJO web application.
  4. myapplicationname.cgi - The CGI wrapper for your XOJO web application.
    [/quote]

Thanks - but need more info…

  1. php-cgi - what causes this to show up in the list? It comes and it goes.
  2. httpd - same question - what causes an instance to show up? When I reach my memory overload case, there a MANY (30 to 50) of these events in the list
  3. and 4. I think I only see one instance of MyApplicationName for each session that is running. However, at times I see many more than that number of myapplicationname.cgi lines listed. What causes these lines to show up?

[quote=104475:@Mark Pastor]Thanks - but need more info…

  1. php-cgi - what causes this to show up in the list? It comes and it goes.
  2. httpd - same question - what causes an instance to show up? When I reach my memory overload case, there a MANY (30 to 50) of these events in the list
  3. and 4. I think I only see one instance of MyApplicationName for each session that is running. However, at times I see many more than that number of myapplicationname.cgi lines listed. What causes these lines to show up?[/quote]

If your site is open to the public it would only be natural that each of these events occur when someone visits your site.

Perhaps WordPress is getting hit by bots - which might explain the httpd’s? But why is my app, that in this stage in development has at most 2 users at a time, generating all those myapplicationname.cgi events? What causes these events?

It only runs when someone clicks the site and terminates when no php requests are happening.

Apache will spawn as many processes as it needs to fulfill the current request load up to your maximum. My server is set with a minimum pool of 10 and a maximum of 100 but rarely gets above 15.

MyApplicationName acts as a supplementary web server hiding behind Apache and will only have one instance open no matter how many processes hit it. When all requests are handled and enough time has passed between requests this should disappear.
myapplicationname.cgi is the CGI handler and will spawn a new copy for each request and will terminate as soon as the request is complete.

Every instance of an event you implement in your web app, and then some. Control Opens(), Shown(), MouseDown(), etc.

If it’s possible for you to deploy stand-alone, it’s really the best option.

[quote=104482:@Brad Hutchings]Every instance of an event you implement in your web app, and then some. Control Opens(), Shown(), MouseDown(), etc.

If it’s possible for you to deploy stand-alone, it’s really the best option.[/quote]
Wow.

  • So I guess there is some latency between an event being completed and the myapp.cgi task from closing - which is why they are queuing up so much?
  • Does that suggest that CGI deployments should be used only for the simplest of applications?

The topic is complicated. If your server will allow you to run stand-alone, and you can get over the deployment and redeployment learning curve – there’s a small one – you’ll find fewer obscure parameters affecting performance. If you need to scale or secure, you’ll find that easier as well if you’re not an Apache wizard.

OK - before I go too far down a crazy path… I should figure out why my cgi app, that is not active (i.e. the users have closed their browsers) still generating myapp.cgi events? Should I be doing something in the app to shut it down more properly?