Full minute timeouts on first page load
This problem is not to do with CiviCRM.

My server defaults to using ipv6 but this is not configured. Therefore when CiviCRM tries a file_get_contents('http...') it is timing out. This vexed me for a while because on the command line wget works fine; I thought I had disabled ipv6 on the server, but turns out file_get_contents doesn't know about that.

Sorry for the non-question! I only saw this happening with CiviCRM. FYI it is triggered by the occasional CiviCRM security checks (which ironically, I recently asked another question about). I don't know when these are triggered; but they are triggered about once a day per user and again if a Drupal user is added.

EDIT

This is not an IPv6 issue, as I originally thought. I now believe it's a problem/quirk of using apache2-mpm-itk as with this worker I get the problem but with the default worker I do not.

I can confirm that this is/was a bug in the Apache MPM ITK module.

For Debian Jessie users, you can get a fix by:

deb http://mirrors.linode.com/debian/ jessie-proposed-updates main


into /etc/apt/sources.list, and then running

apt update &amp;&amp; apt install libapache2-mpm-itk
systemctl restart apache2.service


Apparently this fix will make it into Jessie 8.2, too.