Extreme slowness for unregistered users


This issue was patched in the SVN code. Host lookup will be configurable in future releases of Wikka 1.2.

Symptoms

For unregistered visitors the Wikka site is very slow while registered (logged-in) visitors don't have any problem. May also cause "Fatal error: Maximum execution time of 30 seconds exceeded in [path]\libs\Wakka.class.php on line 1848".

Cause

By default, Wikka does a DNS name lookup for the node an unregistered user is connecting form. If the DNS lookup from the server is slow, this will result in very long response times. For logged-in users such a lookup doesn't take place, so they don't experience such slowness.

Applies to

All current Wikka versions.

Solution

will follow



A patch that DrPain posted in the comments of this page that works for most Wikka versions to force it to stop checking DNS for hostnames first is to find in /libs/Wakka.class.php the section:

  function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; }

and change it to:

  function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else $name = $_SERVER["REMOTE_ADDR"]; return $name; }


CategoryWorkaround
Comments
Comment by 202.72.148.102
2005-03-23 12:35:04
We have two people in entirely different locations, different isps, reporting a loading time of about 7 minutes!!!!
Reported on this forum:
http://www.goosee.com/puppy/sforum/simpleforum_pro.cgi?fid=07&topic_id=1111215715
Comment by DrPain
2005-04-21 19:57:29
I fixed this for myself by getting rid of the DNS lookup by changing line 808 of wikka.php from:

function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) $name = $_SERVER["REMOTE_ADDR"]; return $name; }

To:
function GetUserName() { if ($user = $this->GetUser()) $name = $user["name"]; else $name = $_SERVER["REMOTE_ADDR"]; return $name; }

I'm not familiar with the rest of the wikka code, so I'm not sure what might break with this change, but the delays went away.
Comment by JavaWoman
2005-04-22 09:17:34
DrPain,
Good call. If the server where your Wiki is living happens to have slow DNS lookup, the gethostbyaddr() function will cause slowness... Looks like we need a configuration option for this so people who find DNS lookup slow on their host can just "flip a switch" to prevent this from happening.
Comment by LeoPonton
2009-10-15 05:30:20
v1.2: We use the the wiki internally. There is no DNS lookup. On first install the wiki worked well, but after changing the router and ip scheme, the wiki stopped working for network users (my machine is the server and I was okay).

Manually updating the base_url in wikka.config.php partialy solved the problem, but there was still extreme slowness connecting to the wiki.

The above solution applied to the new and apparently patched Wakka.class.php worked a treat. In other words, although v1.2 appears to have this patch applied, the conditional:
if ($this->config['enable_user_host_lookup'] == 1) // #240
{
$name = gethostbyaddr($ip) ? gethostbyaddr($ip) : $ip;
}
is still causing a problem four years on from the original report.
Comment by BrianKoontz
2009-10-15 14:24:11
So did you try setting 'enable_user_host_lookup' to 0?

The problem isn't a Wikka problem. It's a problem with PHP's implementation of gethostbyaddr(). So the workaround is to simply set 'enable_user_host_lookup' to some value other than 1.
Comment by AlexFranke
2010-02-03 15:13:48
This also caused "Fatal error: Maximum execution time of 30 seconds exceeded in [path]\libs\Wakka.class.php on line 1848" on my server. I updated the "Symptoms" section above to include the error so it will be more searchable.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki