Search code examples
laravelredispredis

Redis/Laravel - Keep getting error: Unknown prefix:


I have been searching and searching for any information regarding this redis error, but so far have not found any information. Any help would be greatly appreciated.

Here is my setup: Laravel with 2 redis connections, 6379 for cache, and 6380 for a datastore.

Every couple of requests to the datastore, I get this error in my logs:

exception 'Predis\Protocol\ProtocolException' with message 'Unknown prefix: '1' [tcp://MY_SERVER_ADDRESS:6380]

This just started within the last few days, and I have not changed anything in the redis config or laravel redis config.

A little more info:

  • I do not have a prefix set in laravel anywhere.. laravel, predis, or redis is adding it itself.

  • The "prefix" that gets added changes, yesterday it was 'O', today it is '1'.

  • This is happening on two separate instances of laravel. The instances share an encryption key, but do not share any files or configs. They both connect to this redis server

Here is the full stack trace:

[2015-02-02 22:19:13] production.ERROR: exception 'Predis\Protocol\ProtocolException' with message 'Unknown prefix: '1' [tcp://MY_SERVER_ADDRESS:6380]' in /var/www/html/vendor/predis/predis/lib/Predis/Connection/AbstractConnection.php:151
Stack trace:
#0 /var/www/html/vendor/predis/predis/lib/Predis/Connection/StreamConnection.php(274): Predis\Connection\AbstractConnection->onProtocolError()
#1 /var/www/html/vendor/predis/predis/lib/Predis/Connection/StreamConnection.php(262): Predis\Connection\StreamConnection->read()
#2 /var/www/html/vendor/predis/predis/lib/Predis/Connection/AbstractConnection.php(130): Predis\Connection\StreamConnection->read()
#3 /var/www/html/vendor/predis/predis/lib/Predis/Connection/AbstractConnection.php(122): Predis\Connection\AbstractConnection->readResponse()
#4 /var/www/html/vendor/predis/predis/lib/Predis/Client.php(246): Predis\Connection\AbstractConnection->executeCommand()
#5 /var/www/html/vendor/predis/predis/lib/Predis/Client.php(228): Predis\Client->executeCommand()
#6 /var/www/html/app/interfaces/RedisRepository.php(47): Predis\Client->__call()
#7 /var/www/html/app/controllers/TrackingController.php(239): RedisRepository->registerNodeEventStatsGlobal()
#8 (): TrackingController->saveTrackerUserData()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch()
#13 (): {closure}()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle()
#22 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle()
#24 /var/www/html/public/index.php(49): Illuminate\Foundation\Application->run()
#25 {main} [] []

Help plz :(


Solution

  • The issue turned out to be specific to HHVM. Once I switched back to PHP-FPM the errors stopped.

    HHVM does still have its quirks.