3

I've got a shiny new Ubuntu 12.10 server running LAMP. My website is nearly completely migrated, but I've got an issue where any request is delayed for a minute.

root@ubuntu:~# time curl http://localhost
... page output ...
real    1m0.134s
user    0m0.000s
sys 0m0.016s

I've already looked at this question to no avail. My /var/log/apache2/error.log has

[Fri Mar 29 20:15:30 2013] [error] (9)Bad file descriptor: apr_socket_accept: 
(client socket)
[Fri Mar 29 20:15:30 2013] [error] [client __.__.__.__] PHP Notice:  
Undefined index: HTTPS in /.../homepage/head.php on line 7, referer: 
http://.../login.php
[Fri Mar 29 20:15:30 2013] [error] [client __.__.__.__] PHP Notice:  
Undefined variable: selector in /.../home.php on line 37, referer: 
http://.../login.php

I've also tried the suggestions here without success. Anyone have any other ideas?

Ryan Kennedy
  • 203
  • 2
  • 11
  • Have you tried creating a bare, empty vhost with no PHP code, and just static content? It will help to isolate the nature of the issue. – Andrew B Mar 29 '13 at 21:14
  • It turns out that my homepage was attempting to connect to the original server's database; this database does not allow external connections. The DB had a 1-minute timeout. I commented out the line where my page connects to the DB and the page loaded at the expected speed (albeit without loading the expected data). – Ryan Kennedy Mar 29 '13 at 23:52
  • Cool. Post that as an answer to your question, then accept the answer when the cooldown period has expired. :) That way it won't show up in searches for unanswered questions. – Andrew B Mar 30 '13 at 01:20

2 Answers2

2

The next time anyone runs into this, just use strace:

strace -Ff -s 512 php /path/to/index.php

strace executes the php binary on the index.php while showing you all the system calls php is making while it is going.

If everything is working right, it will fly past you way faster then you can read it. However if it hangs waiting for something, you can hit ctrl c to stop the strace and read a few lines up. It will have data like what IP it is connecting to and on what port.

This is also very useful for sites that connect to external websites to pull content like ebay, sometimes the sites get blocked in ebays firewall and the site will take forever to load until that times out.

1

It turns out that my homepage was attempting to connect to the original server's database; this database does not allow external connections. The DB had a 1-minute timeout. I commented out the line where my page connects to the DB and the page loaded at the expected speed (albeit without loading the expected data).

Ryan Kennedy
  • 203
  • 2
  • 11