Table of Contents
- Googling the Error
- GridPane Staffer Suggested Redis Was the Culprit
- Digging Further, Confirming LSCache Configuration, Mistakes and Resolution
- Troubleshooting Connection Issues and Testing Redis
- Other Error Messages
- LSCache WordPress Plugin and wp-cli Errors
- Unknown Error Messages
Content Error or Suggest an Edit
Notice a grammatical error or technical inaccuracy? Let us know; we will give you credit!
I was getting the following errors within the error logs for a WordPress site that was on an Openlitespeed server and couldn’t figure out the issue. I replaced the IP address with 0.0.0.0 and the domain with domain.com
2023-04-14 07:31:06.562149 [NOTICE]  [0.0.0.0:21760:HTTP2-3#domain.com] [STDERR] protocol error, got 'E' as reply-type byte 2023-04-14 07:31:10.758529 [NOTICE]  [0.0.0.0:57076:HTTP2-1#domain.com] [STDERR] protocol error, got 'R' as reply-type byte 2023-04-14 07:31:29.775871 [NOTICE]  [0.0.0.0:21760:HTTP2-5#domain.com] [STDERR] protocol error, got 'R' as reply-type byte 2023-04-14 07:31:36.157094 [NOTICE]  [0.0.0.0:57076:HTTP2-3#domain.com] [STDERR] protocol error, got 'O' as reply-type byte 2023-04-14 07:31:42.998521 [NOTICE]  [0.0.0.0:57076:HTTP2-7#domain.com] [STDERR] protocol error, got 'R' as reply-type byte
Googling the Error
There isn’t much about this error other than this phpredis Github issue.
GridPane Staffer Suggested Redis Was the Culprit
I didn’t think it was related until I saw a private GridPane community forum posting. A GridPane staffer mentioned the following
Haven’t seen that one in a few years. You would have a number of options, increase the Redis memory and CPU limits if applied or scale up the system or move to a newer PHP version with better error handling. If PHP isn’t 7.3 or 7.4 and it has been updated in last year, this is memory/timeout issue
I had challenged this
I’ve been getting the same on some sites, and haven’t had a chance to investigate
I’m assuming you found this hence the Redis comment protocol error, got ‘E’ as reply type byte · Issue #369 · phpredis/phpredis · GitHub 1
Have you confirm this error is related to Redis?
Digging Further, Confirming LSCache Configuration, Mistakes and Resolution
I decided to go back and find the site I saw the errors on, the errors were still occurring with every page request.
I decided to disable the LSCache Object Cache setting, and once this occurred, the error went away. But was still present when visiting the Object Cache Settings page, which was actually the LSCache plugin testing the Redis connection. Then I realized the “Connection Test” stated, “Failed”.
At this point, I realized that there was an issue connecting to Redis, so I reviewed the configuration above and found that the port was set to 112111 which is used for Memcached. I changed the port to 6379 which turned the “Connection Test” to “Passed”. The errors no longer showed up in the error log.
Troubleshooting Connection Issues and Testing Redis
The resolution was a simple incorrect port specified, in the example above. However, this is not the only time the errors would show. Anytime there is an issue connecting to Redis this error could potentially come up. If the above resolution didn’t address the errors you’re receiving, then here are some troubleshooting tips.
1. Confirm LSCache Configuration
Confirm that the LSCache plugin is configured correctly and states “Passed” under the “Connection Test”. Ensure you have the right hostname and port, or unix socket location (/var/run/redis/redis-server.sock) and the port set to “0” if you’re using a unix socket.
2. Confirm Redis server is running and listening for connections
Confirm Redis server is running and listening
netstat -anp | grep redis
3. Test Connecting to Redis
Even if Redis is running, you might not be able to connect to it for a number of reasons. So use the following PHP script and upload it to the webroot of your website. Make sure to change the Unix socket and TCP socket information.
<?php // Connect to Redis Unix socket $unixSocketRedis = new Redis(); $unixSocketRedis->connect('/var/run/redis.sock'); // Set a key-value pair via Unix socket $unixSocketRedis->set('unixkey', 'unixvalue'); // Get the value for a key via Unix socket $unixValue = $unixSocketRedis->get('unixkey'); // Output the Unix socket value echo "Unix socket value: $unixValue\n"; // Close the Unix socket connection $unixSocketRedis->close(); // Connect to Redis TCP socket $tcpSocketRedis = new Redis(); $tcpSocketRedis->connect('127.0.0.1', 6379); // Set a key-value pair via TCP socket $tcpSocketRedis->set('tcpkey', 'tcpvalue'); // Get the value for a key via TCP socket $tcpValue = $tcpSocketRedis->get('tcpkey'); // Output the TCP socket value echo "TCP socket value: $tcpValue\n"; // Close the TCP socket connection $tcpSocketRedis->close(); } ?>
4. Other Suggestions
- If the methods above fail, then you need to dig deeper and confirm if a username and password is set.
- If you’re using the unix socket method to connect, ensure the correct permissions are set so that your website’s PHP worker can connect. This will be contained within redis.conf. Depending there could be a permission issue.
- With a TCP socket, perhaps name resolution will be an issue, so try 127.0.0.1 for the hostname. You could also try and connect to the TCP socket using
telnet localhost 6379
5. Redis Timeouts
It’s quite possible that the Redis request is timing out or there is an issue with the Redis server responding. This is a sign up resources issues on the server your website is located. You can confirm this by accessing your site and checking the log. You could tail -f the log file using SSH.
Other Error Messages
Here are error messages you might also encounter, mainly for the Google search index.
LSCache WordPress Plugin and Redis Socket
This occurred when not setting the port to 0 and using a Unix socket as the hostname. If you’re using a Unix socket, you must set the port to 0 in LSCache.
2023-04-14 07:48:08.473725 [NOTICE]  [0.0.0.0:49136:HTTP2-3#domain.com] [STDERR] php_network_getaddresses: getaddrinfo failed: Name or service not known
If you enter the incorrect information in the LSCache configuration fields, it could result in the following errors.
2023-04-14 08:32:37.955912 [NOTICE]  [0.0.0.0:40926:HTTP2-5#domain.com] [STDERR] Invalid argument
LSCache WordPress Plugin and wp-cli Errors
If you’re using wp-cli and for some reason, there is an issue with the LSCache WordPress plugin connecting to Redis. You will see the error show up in wp-cli which can cause issues with automation or provide a false sense of urgency that your WordPress has a severe error. When in reality it’s simply a connection issue, that should be logged and not through wp-cli.
Unknown Error Messages
Here are some errors that you might see that I have not been able to track down. Most of them relate to the phpredis extension for PHP
2022-10-05 07:59:36.561241 [NOTICE]  [0.0.0.0:18118:HTTP2-5#domain.com] [STDERR] PHP Fatal error: Uncaught RedisException: protocol error, got 'a' as reply type byte 2022-10-05 07:59:36.936958 [NOTICE]  [0.0.0.0:42562:HTTP2-1#domain.com] [STDERR] protocol error, got '[' as reply-type byte 2022-10-05 07:59:37.435134 [NOTICE]  [0.0.0.0:37064:HTTP2-3#domain.com] [STDERR] protocol error, got '^' as reply-type byte