Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use phpredis driver #10

Open
mathewpeterson opened this issue Oct 17, 2014 · 7 comments
Open

Unable to use phpredis driver #10

mathewpeterson opened this issue Oct 17, 2014 · 7 comments

Comments

@mathewpeterson
Copy link

I am not able to use the phpredis driver. I am using the following versions: bernard/bernard => 50bc62608f8ee981c42522045bd94ce07b5d6f49, bernard/bernard-bundle => bb0ced39d96d8d8c3c2f96642455eab075b352d9, and snc/redis-bundle => c07fde6155bce0647204fbd4f9b249df95cc2922

Here are my config files:

bernard_bernard:
    driver: phpredis
    serializer: simple
snc_redis:
    clients:
        bernard:
            type: phpredis
            alias: bernard
            dsn: %redis_dsn%
            logging: false
            options:
                prefix: %redis_prefix%

There seems to be two issues, one that I can resolve, and the other I can't seem to figure out.

First the one that I can resolve:

SncRedisBundle restructured their client (snc/SncRedisBundle@30565b8#diff-babf1c52f9bae7fffab1219e227de24eR21)

Basically, they no longer return a instance of \Redis and instead return an instance of ClientInterface

I can temporarily bypass to change the typehint in the driver (https://github.com/bernardphp/bernard/blob/master/src/Bernard/Driver/PhpRedisDriver.php#L17) in the bernard/bernard bundle.

Now to the second issue I can't seem to figure out:

When I try and run the app/console bernard:consume my-message-queue command, I instantly receive a redis exception:

  [RedisException]
  read error on connection

I'm open to suggestions on how to debug this.

@henrikbjorn
Copy link
Contributor

It should be fixed directly in the Driver i think.

@henrikbjorn
Copy link
Contributor

Ohh this is something that should be fixed in a bundle version as that commit breaks BC.

@mathewpeterson
Copy link
Author

Yes, the first issue should be fixed in the bernard/bernard project.

I'm am not entirely sure if the second issue is with the bundle or upstream. I'm just looking for a little guidance.

@henrikbjorn
Copy link
Contributor

It is with the bundle, as the bundle wraps the real redis object, trying to enhance it. But doing so they broke BC with everything before, best thing to do is proberly just create your own redis service directly.

@mathewpeterson
Copy link
Author

I was able to create a simple factory service that produced a configured \Redis instance. That seems to work for the moment.

@sbacelic
Copy link
Contributor

sbacelic commented Apr 21, 2017

 [RedisException]
  read error on connection

Exception trace:
 () at /vendor/bernard/bernard/src/Driver/PhpRedisDriver.php:69
 Redis->blPop() at /vendor/bernard/bernard/src/Driver/PhpRedisDriver.php:69
 Bernard\Driver\PhpRedisDriver->popMessage() at /vendor/bernard/bernard/src/Queue/PersistentQueue.php:95

I found this issue while debugging "read error on connection" exception when phpredis driver is used. SncRedisBundle sets connection_timeout to 5 by default. Since blpop duration is also 5 seconds, exception is thrown. You need to make connection_timeout > 5 to avoid exception in the worker (consumer). I hope this will save someone else some headache 😄

I submitted pull req #47 to include this notice in README.txt

@acrobat
Copy link
Member

acrobat commented Nov 5, 2017

Is this still an issue or can it be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants