vBulletin has two bugs which drastically affect the performance and reliability of the default vBulletin forum installation. This post explains the two bugs and shows you how to fix them.
Invalid key name. (Causes Invalid or Corrupted Datastore)
Have you ever gotten this error when using memcached?
Fatal error: vBulletin datastore cache incomplete or corrupt.
When you are using multiple memcached servers to power your vBulletin installation, vbulletin will actually try to fall back onto the database if there is a memcahed outage (Graceful Degradation.) However, in the process of falling back, it passes the same keys that it stores in memcached to the database. That would be great if only the key names did not differ between memcached and the database.
vBulletin appends a prefix to the key names only for the memcached service in order to prevent key hash clashing with servers running multiple installations of vBulletin. If the software did not do this you could not have 2 or more vbulletin websites using the same memcached server.
After the key names are prefixed with the COOKIE_PREFIX config setting, vbulletin then stores and retrieves the values from memcached. It is on the fetch function of vbulletin’s memcached implementation does this affect your website. If your memcached server does not have the item in the server (because the server was reset or the items expired in cache), vBulletin will then try to go to the database. However instead of asking the database for the correct item using the real key name, it will use the key name that has been prefixed with the COOKIE_PREFIX for the database query. The server will return 0 results. When this happens, vBulletin has no option but to crash and ask you to rebuild your datastore.
Bug 2: vBulletin Memcached Availability Dependency
This bug is concerning users who are only using 1 memcached server, or users who are using PHP with the php-memcache module v. 1.5.0 or older. vBulletin will throw the error:
Unable to connect to memcache server.
This is because if the memcached connection is not available, vBulletin will just give up and die. This is a big no-no. Cache’s are meant to be a convenience, not a dependency. If the cache is unavailable or if the cache request misses, basic logic is to return to the data source and try to get the original information. The fix is a simple one liner, which replaces all
trigger_error(‘Unable to connect to memcache server’, E_USER_ERROR);
The return “3″ is just an arbitrary number, the function which the errors occur in already have a number code return type.
We have submitted the bug reports to vBulletin, available at: