Skip to content

Any pitfalls to STREAM_CLIENT_PERSISTENT ? #79

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

Open
francislavoie opened this issue Dec 21, 2020 · 1 comment
Open

Any pitfalls to STREAM_CLIENT_PERSISTENT ? #79

francislavoie opened this issue Dec 21, 2020 · 1 comment

Comments

@francislavoie
Copy link

I'm just wondering if you're aware of any downsides to enabling STREAM_CLIENT_PERSISTENT for this lib, for a php-fpm or mod_php app? I don't see it recommended in the README, but I see it's mentioned as supported.

I'm evaluating which Redis client implementation I want to use, whether I'll need to use a PHP extension for performance or if this implementation would be fast enough most of the time.

Thanks!

@francislavoie
Copy link
Author

francislavoie commented Dec 22, 2020

I think STREAM_CLIENT_PERSISTENT mode is bugged:

        $redis = new RedisClient([
            'server' => '127.0.0.1:6379',
            'connection' => [
                'flags' => STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT,
            ]
        ]);
PHP Warning:  fclose(): supplied resource is not a valid stream resource in /home/francis/repos/cache/vendor/cheprasov/php-redis-client/src/RedisClient/Connection/StreamConnection.php on line 98
PHP Stack trace:
PHP   1. {main}() /home/francis/repos/cache/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main() /home/francis/repos/cache/vendor/phpunit/phpunit/phpunit:61
PHP   3. PHPUnit\TextUI\Command->run() /home/francis/repos/cache/vendor/phpunit/phpunit/src/TextUI/Command.php:162
PHP   4. PHPUnit\TextUI\TestRunner->doRun() /home/francis/repos/cache/vendor/phpunit/phpunit/src/TextUI/Command.php:206
PHP   5. RedisClient\Connection\StreamConnection->__destruct() /home/francis/repos/cache/vendor/cheprasov/php-redis-client/src/RedisClient/Connection/StreamConnection.php:0
PHP   6. fclose() /home/francis/repos/cache/vendor/cheprasov/php-redis-client/src/RedisClient/Connection/StreamConnection.php:98
PHP Warning:  fclose(): supplied resource is not a valid stream resource in /home/francis/repos/cache/vendor/cheprasov/php-redis-client/src/RedisClient/Connection/StreamConnection.php on line 98

I think it should skip calling fclose() in __destruct() if STREAM_CLIENT_PERSISTENT was set?

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

1 participant