Varnish – WordPress – and the “new” kid on the block (IPv6)

IPv6-Forum-Gold-Certified-EngineerWell, this was not expected……

I’ve been playing around with Varnish these days, and it’s awesome… Super fast, and keeps the load of your web server. But now it was time to move this blog on to varnish. This sites has IPv6 enabled, but without native IPv6 connection at home, I would just enabled it, and used IPv4 as I always do.

First it looked good, surfing was super fast, and the web server wasn’t getting any extra hits, but then I tried logging in…. Blank screen of death…
Going through my logs, and notice this wondeful line.

[Tue Mar 11 10:17:56 2014] [error] [client x.x.x.x] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /*/wordpress/wp-includes/class-http.php on line 1234, referer: http://dev.n0ll.com/wordpress/wp-admin/index.php

Okey, Now I now something is wrong, but when something fails  within wordpress core, there is usually something else wrong. One quick look in class-http.php file and a couple quick searching on the web, this is wordpress implementation of curl. Do I have any plugins/theme that uses curl? Do I have something fishy going on? Why are my wordpress backend doing curl request?

After deactivating and temperately changing themes to rule out any of those, I check the database, maybe some kind of script had been push to the DB, no luck…. Time to get dirty, take out tcpdump and start dumping…

Since this is shared host, with multiple website, It took a little while before everything “known-good” packets where filtered.. Still nothing that look suspicious. Tracking down the exact timeline, I notice that the webserver where doing DNS lookups for the domain….. crap..

IPv6 is favored over IPv4, so even if I do a IPv4 request to my site, the webserver will do a lookup and use Ipv6.
In normal circumstances this would not be a problem, but due to the fact my hosting provider is having some local IPv6 issues, and I do not have IPv6 connectivity between my webserver and my varnish server, this was causing the the timeout.

To verify, I cheated, and modified /etc/hosts to point the domain to webserver.

So what next? Should you change php.ini to lower the timeout? Should WordPress issue a local timeout in their http-class? Who knows, this is one of those rarer issues, where there is no problem when everything works…….

And by the way, I aced the last CCNP exam (TSHOT) with 1000 out of 1000 points, So now I can call myself a CCNP.  And if you do have a CCNP you can apply for a IPv6 Certified Engineer (The application has been sent). Happy days.

CCNP_CERTIFIED

Leave a Comments