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

Connection is not closed after close() #1733

Open
hserge opened this issue Apr 6, 2020 · 3 comments
Open

Connection is not closed after close() #1733

hserge opened this issue Apr 6, 2020 · 3 comments
Labels

Comments

@hserge
Copy link

@hserge hserge commented Apr 6, 2020

Expected behavior

When connection is closed by close(), consecutive commands should fail or throw an exception.

Actual behaviour

After closing the connection consecutive commands are run as connection is still open.

I'm seeing this behaviour on

  • OS: OSX 10.15.3
  • Redis: Redis 5.0.8 (00000000/0) 64 bit
  • PHP: 7.4
  • phpredis:

Steps to reproduce, backtrace or example script

$r = new Redis();
$con = $r->connect('127.0.0.1'); // returns true
$r->close(); // returns true
$info = $r->info(); // returns array of info
$r->select(15); // returns true
$data = $r->xRange('payday', '-', '+'); // returns data from the stream

I've checked

  • There is no similar issue from other users
  • Issue isn't fixed in develop branch
@yatsukhnenko
Copy link
Member

@yatsukhnenko yatsukhnenko commented Apr 11, 2020

@hserge phpredis automatically reconnects when you call commands after close

@hserge
Copy link
Author

@hserge hserge commented Apr 11, 2020

@yatsukhnenko probably makes sense to add this "hidden" feature to the close() method description.
Is there a way to avoid reopening after the connection is closed? Is there a way we can check if the connection is already closed?

@yatsukhnenko
Copy link
Member

@yatsukhnenko yatsukhnenko commented Apr 12, 2020

@hserge to check the connection state you can use isConnected method

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.