Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have Ubuntu 12.04 64-bit and Apache 2.2.22 installed on my machine used for development. Anyway, it seems from one day to the next that it would serve the pages in milliseconds to now 5 minutes 1 second every time. I believe that this is because the timeout value is 300 in the apache.conf. What I don't understand is why it is timing out.

I have xdebug installed but I am not triggering it and it is not on autostart so I really think this would have made no difference and they were working together fine before.

I am a complete noob at Apache and not sure how to start debugging the issue. I have checked the logs but they don't seem to give me anything interesting. The Apache error.log is not changing and only producing a notice log when it boots.

The actual app log is a bit more interesting as in it does update the app-access.log and the app-error.log, however the access log just says the GET requests and the error log is all info. The make no sense to me so here is an example of one from a request.

[Mon Jan 20 12:01:39 2014] [info] [client 127.0.0.1] (32)Broken pipe: core_output_filter: writing data to the network
[Mon Jan 20 12:01:43 2014] [info] [client ::1] Connection to child 6 established (server app:443)
[Mon Jan 20 12:01:43 2014] [info] Seeding PRNG with 656 bytes of entropy
[Mon Jan 20 12:01:43 2014] [info] [client ::1] SSL library error 1 in handshake (server app:443)
[Mon Jan 20 12:01:43 2014] [info] SSL Library Error: 336027900 error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol speaking not SSL to HTTPS port!?
[Mon Jan 20 12:01:43 2014] [info] [client ::1] Connection closed to child 6 with abortive shutdown (server app:443)

The thing is that it only produces a log when the page is served which is minutes later (after the apparent 5 min timeout). It seems that it takes ages for the request to actually hit the app. I am not sure what is the best way to go about finding why this is the case. I have made no changes recently to my configuration so I really don't see why it has suddenly gone awry.

share|improve this question
    
You have to find the bottleneck. Configure apache to disable dns lookup and enable debug loglevel, try to use http first, look at your system's network connections (netstat), list open files (lsof), check server load including cpu, i/o and ram usage (top). –  SamK Jan 20 '14 at 13:47

2 Answers 2

up vote 1 down vote accepted

Well if the config didn't change, you have no choice but to limit the timeout to 2 seconds, then you have 3 second load time.. ;) Okey, let's try something helpful..

You say you use it for local development testing?

Can you remember what the very last change was to any of the following:

  • Your web application, any changes between when it was working and when it wasn't?
    • Is there a for .. loop that runs infinitely?
    • Or is your application making a request to a another server that is not responding?
  • Any other logs to check? PHP's error log or any other scripting language's that you may be using.
  • Database settings, table structures? Constraints? Procedures?
    • Are you using a database that has some locks that your application is waiting for?
  • Scripting language settings (PHP, Perl, Python, Ruby which are you running?)
  • Apache settings
    • Modules
    • Virtual Hosts
    • .htaccess files?
  • Any updates to any other services on the server?
  • Any firewall changes?
  • Any updates of database, scripting language or Apache?

Other things to check:

  • If that does not help, you should increase the verbosity of Apache's logging up to debug in steps and see what is going on during the 5 minutes..
  • You may also see which process is using the cpu while the request is running (if any at all), e.g. PHP taking up an entire CPU core? Or maybe mysqld (or any other database daemon)..

[EDIT] See this too: http://servertune.com/kbase/?View=entry&EntryID=109

share|improve this answer
    
Sugar! Cheers I found it. I was so stupid. The for loop jogged my memory. I was in a wrong branch and I on my dev machine I dont have Alternative PHP Cache (APC) enabled and this caused the issue. Thanks Chris it was so stupid of me but you hit it on the nail –  bubblebath Jan 20 '14 at 14:21
    
Welcome, it's only my stupidity that I need these checklists for problem solving ;) .. –  Chris Jan 20 '14 at 16:42

Edit /etc/apache2/ports.conf

Make sure the Listen 80 line comes last. [1]

If that doesn't resolve the issue, replace Listen *:443 or Listen 443 with Listen *:443 http [2]

Also, apparently, apache2ctl graceful isn't sufficient for this change to take effect, be brutal:

apache2ctl restart

Good Luck.

1: http://wiki.apache.org/httpd/InternalDummyConnection

2: https://netfuture.ch/2013/07/ubuntu-apache-update-broke-listen-command/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.