redlock-php icon indicating copy to clipboard operation
redlock-php copied to clipboard

Fatal error: Uncaught exception 'RedisException' with message 'read error on connection'

Open tenstep opened this issue 9 years ago • 1 comments

when i test the redlock file, the program terminates with following fatal error:

Fatal error: Uncaught exception 'RedisException' with message 'read error on connection' in C:\OpenSource\xampp\htdocs\demo\vendor\ronnylt\redlock-php\src\RedLock.php on line 99 RedisException: read error on connection in C:\OpenSource\xampp\htdocs\demo\vendor\ronnylt\redlock-php\src\RedLock.php on line 99

The test code is as follow:

    $servers = [
        ['127.0.0.1', 6379, 0.01]
    ];

    $redLock = new RedLock($servers);
    $i = 0;
    while ($i<100) {
        echo $i."\r\n";
        $lock = $redLock->lock('newOrder', 1000);

        if ($lock) {
            var_dump($lock);
        } else {
            echo "Lock not acquired\r\n";
        }
        $i++;
    }

Sometimes it runs without error, however, it terminates with error most of the time, what's the problem?

tenstep avatar Oct 01 '15 13:10 tenstep

Try with unlimited timeout, this solves my problem.

$servers = [
        ['127.0.0.1', 6379, 0],
    ];

Keris avatar May 09 '17 08:05 Keris