[Techtalk] Name Service Lookup Fails Under Wordpress

Kai MacTane kai at mactane.org
Mon Jan 18 21:08:21 UTC 2010


I am at my wits' end on this one. Sorry this is so long.

I have a Slackware 12.1 machine running DNS/Web/email/etc. for a variety
of domains. Some of them have WordPress installations running on them. I 
also have some Dreamwidth accounts that I want to cross-post my 
WordPress posts to, and there's a nifty WP plugin called Livejournal 
Crossposter (or LJXP, for short) that does so automatically.

As long as it can get proper DNS lookups. And therein lies the problem.

The machine's main IP address is 72.51.52.4, and kai.mactane.org is one 
of the domains on that IP. The blog on that domain is working 
spiffingly; whenever I post in kai.mactane.org/blog, LJXP automatically 
crossposts to kai-mactane.dreamwidth.org.

On 72.51.52.5, I have dev.ninja-coder.net, where I'm getting design and 
technical issues hashed out before I go live. When I post something 
there, I get the error:

    Something went wrong - -32300 : transport error - could not
    open socket: 0 php_network_getaddresses: getaddrinfo failed:
    Temporary failure in name resolution

Moving the ninja-coder.net domain to 72.51.52.4 does not change this 
result. Nor does shifting the blog to www.ninja-coder.net. In case it 
matters, the machine is its own primary name server; /etc/resolv.conf reads:

    search silmemar.org
    nameserver 127.0.0.1
    nameserver 72.51.52.4

(Silmemar.org is the machine's most canonical domain.) Commenting out 
the "nameserver 127.0.0.1" line also doesn't make any difference.

Some grepping through the WP code shows me that the error's occurring in 
LJXP's ljxp_post() function. That function creates an instance of 
IXR_Client, which is a standard WP class defined in 
wp-includes/class-IXR.php. The IXR_Client->query() method tries to do an 
fsockopen() call, and that's what fails.

PHP does not have a getaddrinfo() call; I presume that's an internal C 
call. PHP *does* have gethostbyname(), and here's the weird part:

* If I run a gethostbyname() call on the wp-admin/index.php page
   on kai.mactane.org, it works just fine.
* Similarly, if I run gethostbyname() inside the IXR_Client->query()
   method on kai.mactane.org, it works fine (and the LJ cross-
   posting is working fine on that blog).
* If I run gethostbyname() in the ninja-coder.net admin index page,
   it works just fine.
* But if I run it in the IXR_Client->query() method on ninja-coder.net,
   it fails.

I can't get an error message out of it, because PHP's gethostbyname()'s 
failure mode is simply to return the unmodified hostname instead of an 
IP address.

This problem initially started with WordPress version 2.8.4; upgrading 
to 2.9.1 hasn't changed things any.

I've traced this through the PHP code about as much as I can, and it 
looks like determining the underlying cause is beyond me. Can anyone help?


-- 
Kai MacTane
LAMP, AJAX, and Ruby on Rails developer
http://kai.mactane.org


More information about the Techtalk mailing list