Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Lock] "NOSCRIPT No matching script. Please use EVAL." after updating to symfony/lock 7.2.3 #59686

Copy link
Copy link
Closed
@acelaya

Description

@acelaya
Issue body actions

Symfony version(s) affected

7.2.3

Description

Using symfony/lock's RedisStore with a predis Client, can randomly throw a Predis\Response\ServerException with the message NOSCRIPT No matching script. Please use EVAL. when trying to create a lock.

I haven't been able to reproduce it consistently, as it seems it can sometimes get solved by restarting the redis server.

This didn't happen with v7.2.0, only with v7.2.3, and by looking at the diff, I see things are being handled differently for this particular error, so I guess those changes are related.

How to reproduce

Create a folder with the following files:

docker-compose.yml

services:
    redis:
        image: redis:7.4-alpine
        ports:
            - "6381:6379"

composer.json

{
    "name": "acelaya/symfony-lock-error-repro",
    "type": "project",
    "require": {
        "symfony/lock": "7.2.3",
        "predis/predis": "^2.3"
    }
}

index.php

<?php

declare(strict_types=1);

use Predis\Client;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\RedisStore;

require __DIR__ . '/vendor/autoload.php';

$predisClient = new Client('tcp://127.0.0.1:6381');
$lockStore = new RedisStore($predisClient);
$lockFactory = new LockFactory($lockStore);

$lock = $lockFactory->createLock('test');
$lock->acquire();
$lock->release();

Then run the following commands:

  1. docker compose up -d
  2. composer install
  3. php index.php

You will see the following error:

PHP Fatal error:  Uncaught Predis\Response\ServerException: NOSCRIPT No matching script. Please use EVAL. in /symfony-lock-error/symfony-lock/vendor/predis/predis/src/Client.php:416
Stack trace:
#0 /symfony-lock-error/symfony-lock/vendor/predis/predis/src/Client.php(385): Predis\Client->onErrorResponse()
#1 /symfony-lock-error/symfony-lock/vendor/predis/predis/src/Client.php(335): Predis\Client->executeCommand()
#2 /symfony-lock-error/symfony-lock/vendor/symfony/lock/Store/RedisStore.php(287): Predis\Client->__call()
#3 /symfony-lock-error/symfony-lock/vendor/symfony/lock/Store/RedisStore.php(200): Symfony\Component\Lock\Store\RedisStore->evaluate()
#4 /symfony-lock-error/symfony-lock/vendor/symfony/lock/Lock.php(218): Symfony\Component\Lock\Store\RedisStore->delete()
#5 /symfony-lock-error/symfony-lock/index.php(16): Symfony\Component\Lock\Lock->release()
#6 {main}

Next Symfony\Component\Lock\Exception\LockReleasingException: Failed to release the "test" lock. in /symfony-lock-error/symfony-lock/vendor/symfony/lock/Lock.php:223
Stack trace:
#0 /symfony-lock-error/symfony-lock/index.php(16): Symfony\Component\Lock\Lock->release()
#1 {main}
  thrown in /symfony-lock-error/symfony-lock/vendor/symfony/lock/Lock.php on line 223

If you update the composer.json like this

{
    "name": "acelaya/symfony-lock-error-repro",
    "type": "project",
    "require": {
-        "symfony/lock": "7.2.3",
+        "symfony/lock": "7.2.0",
        "predis/predis": "^2.3"
    }
}

Then run composer update and then php index.php, you'll experience no such error.

Possible Solution

Downgrading to symfony/lock 7.2.0 seems to work around the issue for now

Additional Context

For context, this was first reported here shlinkio/shlink#2350

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.