After updating php-redis to version 5 I got a full log of error on cron run:

Deprecated function: Function Redis::delete() is deprecated in Redis_Lock_PhpRedis->lockRelease() (line 111 of /web/sites/all/modules/contrib/redis/lib/Redis/Lock/PhpRedis.php).

Comments

alesr created an issue. See original summary.

alesr’s picture

Status: Active » Needs review
Related issues: +#3068810: Not compatible with php-redis 5
StatusFileSize
new663 bytes

The delete() method was deprecated.
Method del() should be used instead after looking into Redis 5 documentation.

There are just two references in Redis client object in Drupal 7.x-3.x-dev version where delete() is used instead of del() which is changed in the patch that is attached.

littlepixiez’s picture

#2 works for me on version 7.x-3.17; we just upgraded to php-redis 5.0.2 and these errors started filling our logs. Thanks a lot @alesr!

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, thanks!

shaneonabike’s picture

Also works great for me could we push this to the latest dev?

julienjoye’s picture

Hey, I re-rolled #2 patch for those who still run drupal/redis:2.15 (yeah I know..)
Cheers.

julienjoye’s picture

WiseMike’s picture

#2 works for me. Thanks a lot @alesr!

damienmckenna’s picture

When was this method added? Would committing this change break any sites running older versions of phpredis? Does there need to be some sort of switch to indicate which method to use?

alesr’s picture

From php-redis documentation: https://github.com/phpredis/phpredis#del-delete-unlink

Note: delete is an alias for del and will be removed in future versions of phpredis.

Which they did in php-redis 5 so both del() and delete() work in older version, but only del() works from 5+.

Rafal Lukawiecki’s picture

I have applied this patch in our production environment and I am happy to report that it works and solved the issue of the errors. In our case those errors were more than just log spam, they were causing the site's PHP FPM to time out—I suppose there was a caching related issue caused by the Redis update.

Many thanks for the patch, it has my vote to be merged into the development branch.

xito’s picture

I tested the patch on my site and it fix the issue with REDIS.

So, I give my vote to be merged on the dev branch.

Thanks @alers

heddn’s picture

The del command was only aliased/added in 3.x of php-redis. Does this need to support v2, where it wasn't aliased?

heddn’s picture

I don't see any widely documented version constraints of what version folks need to use php-redis. Can we add a BC layer in there and see if del exists? Otherwise we might break sites w/ older versions of the upstream library.

damienmckenna’s picture

Status: Reviewed & tested by the community » Needs work

Agreed, it should either check to see which API is being used or provide an option to control that on the settings page (like the Memcache module does), and then do a quick if/else check to determine which API to use.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new869 bytes

Since this is D7, let's not get too fancy. Let's try this on for size. No interdiff as this is a different approach.

rob230’s picture

Patch #16 working well for us.

rob230’s picture

Status: Needs review » Reviewed & tested by the community
damienmckenna’s picture

StatusFileSize
new1.06 KB

The same as #16 only with a comment on the new method.

mattdaniel’s picture

Patch #19 is working for us, thank you!

jedihe’s picture

Patch #19 worked for me; using php redis extension 5.1.1 with a D7 site.

Just a note for anybody wanting more details: using redis 4.3.0 (sudo pecl install redis-4.3.0) also works, since the deprecation notice was added starting with version 5. Of course, the best course of action is to utilize the newer version, if possible.

glynster’s picture

#19 resolved the problem for us as well. We are now able to use the latest version og php-redis 5.1.1. Thank you @DamienMcKenna RTBC +1

qzmenko’s picture

StatusFileSize
new3.45 KB
new2.21 KB

After upgrading php-redis to version 5, I'm also starting to see a new error:

Fatal error: Redis::multi(): Can't activate pipeline in multi mode!

Seems like we need to change $client->multi(Redis::PIPELINE) to $client->multi() as this was done in patch for D8 version of module in related issue https://www.drupal.org/project/redis/issues/3068810#comment-13218617

Attached patch with interdiff.

qzmenko’s picture

Status: Reviewed & tested by the community » Needs review
eiriksm’s picture

Status: Needs review » Reviewed & tested by the community

Great! Works for me!

schnippy’s picture

Patch at #23 successfully resolved the issue for me.

sokru’s picture

#19 worked for me.
#23 @qzmenko I haven't had similar errors, but I'm running redis-server 3.0.6.

i-trokhanenko’s picture

#19 works for me too, tested with Drupal 7.69, php7.3, redis 3.0.6
Thanks

markdorison’s picture

Patch #23 is working as expected for me.

summit’s picture

Hi, #23 is great. Thanks! Can this please be committed?
Thanks a lot in advance!
greetings and stay save, Martijn

hey_germano’s picture

+1 for the patch in #23.

delacosta456’s picture

hi
#23 is ok for me too on config below
- Panoply distro 1.72(D7.69)
-php7.1.31
-redis5.2.1

Thanks

dandaman’s picture

+1 to patch #23.

Tested on a few sites which were upgraded from Redis 3.x to 5.x and it worked great!

AmiOta’s picture

Can you add this to a new release, please?

torgospizza’s picture

Patch in #23 also worked for me in clearing up those warnings, and made my Drupal 7 install much faster in return.

spjsche’s picture

Thanks for the effort on the patch, but is there any chance for it to be committed.

Stay SAFE.

damienmckenna’s picture

jefflogan’s picture

+1 for patch in #23

dbouman’s picture

+1 patch #23 worked for me too

dydave’s picture

Hi everyone,

Thank you very much for contributing a patch to this issue.

I would like to confirm patch from #23 applied without error and fixed the problem in my case, with:

  • Drupal 7.75
  • Redis 7.x-3.18
  • Phpredis version 5.3.2

Confirming patch could be committed and added to the module.
Thanks!

johan den hollander’s picture

Hi everyone,

Thank you very much for contributing a patch to this issue.

I would like to confirm patch from #23 applied without error and fixed the problem in my case, with:

Drupal 7.82
Redis 7.x-3.18
Phpredis version 6.2

Confirming patch could be committed and added to the module.
Thanks!

SoportePRO’s picture

I see in the Redis website (https://redis.io/download) that the latest stable version until today is 6.2.5 (09/2021). This module and patch works with it?

damienmckenna’s picture

This is required when using PHP 7.4 on Pantheon.

caesius’s picture

Confirming that #23 works after running into this on Pantheon.

jtjones23’s picture

Confirming that #23 works when running on Pantheon.

Drupal 7.82
PHP 7.4
MariaDB 10.4

nicobot’s picture

Confirm #23 fixes the problem on Pantheon.

Thank you!

maskedjellybean’s picture

Another confirmation #23 fixes the problem on Pantheon.

Thank you!

  • qzmenko authored cbea2aa on 7.x-3.x
    Issue #3074189 by qzmenko, DamienMcKenna, alesr, heddn, julienjoye: [D7...
kporras07’s picture

Status: Reviewed & tested by the community » Fixed

Works great! Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.