Isn’t it frustrating to experience errors like ‘Memcached error 47’?
Memory caching systems generally speeds up web applications. However, the error code 47 indicates a temporary problem with memcached connection.
At Bobcares, we often receive requests to fix Memcached errors as a part of our Server Management Services.
Today, let’s see what causes this error and see how our Support Engineers fix it.
What does the memcached error 47 indicate?
Let’s now do a detailed analysis of the error.
Error code 47 means MEMCACHED_SERVER_TEMPORARILY_DISABLED. In general, it is the libmemcached program that generates this error. We get it when the Memcached connection goes into a TCP timeout or passes its retry limit.
Generally, it is a temporary error and is treated as a standard connectivity error.
Different reasons for Memcached error to occur
Memcached doesn’t give the exact reason behind the error 47. Let’s look into the reasons that cause this error to occur.
If there are any recent changes made in the PHP application and the website is still not able to pull it due to cache, then this error shows up on the website.
So, it is very essential to clear the cache regularly.
2. Module error
If the Memcached itself has any problem, then it will throw errors on the website.
So, the best option is to disable and re-enable the module and check if the error fixes.
3. Bad Memcached settings
Additionally, bad settings in Memcache server configuration can also be a problem. For instance, when specifying the Memcache server name as ‘localhost’ instead of ‘127.0.0.1’ can create errors. As a result, the application fails to read from the server.
Therefore, we always double-check the server settings. A sample setting in Prestashop application appears as:
How we fix Memcached error 47?
Recently, one of our customers approached us with the below error message in the FuelPHP framework.
memcached error 47
Our Support Engineers started troubleshooting the error by clearing the cache from the website.
Even after clearing it, the error still was there which confirms that the problem was not with the cache.
We then fixed this error by running the below command:
ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
Similarly, in some cases disabling of the
tcp_nodelay in the application code also fixes the error.
[Need any help in fixing Memcached error? – We’ll help you]
In short, Memcached error 47 happens when the connection goes into a TCP timeout or passes its retry limit. It is a temporary problem. Today, we saw how our Support Engineers fix this error.