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

Uncaught Predis\Connection\ConnectionException: Error while reading line from the server. #183

Closed
JESii opened this issue Jul 13, 2022 · 6 comments

Comments

@JESii
Copy link

JESii commented Jul 13, 2022

I'm running phpRedisAdmin through an ssh tunnel to one of our work environments.
MacOS : 11.6.5
Redis: 6.2.6
Redis there is configured to use port 6380, so I ran the following docker command:

docker run --rm \
  -p 8092:80 \
  -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
  -e REDIS_1_HOST=host.docker.internal \
  -e REDIS_1_NAME=redis \
  -e REDIS_1_PORT=6380 \
  -e REDIS_TLS=true \
  -e REDIS_PASSWORD=$1 \
  erikdubbelboer/phpredisadmin:latest

when I run http://localhost:8092, there's pause and then:

<br />
<b>Fatal error</b>:  Uncaught Predis\Connection\ConnectionException: Error while reading line from the server. [tcp://host.docker.internal:6380] in /src/app/vendor/predis/predis/src/Connection/AbstractConnection.php:155
Stack trace:
#0 /src/app/vendor/predis/predis/src/Connection/StreamConnection.php(314): Predis\Connection\AbstractConnection-&gt;onConnectionError('Error while rea...')
#1 /src/app/vendor/predis/predis/src/Connection/AbstractConnection.php(120): Predis\Connection\StreamConnection-&gt;read()
#2 /src/app/vendor/predis/predis/src/Connection/AbstractConnection.php(112): Predis\Connection\AbstractConnection-&gt;readResponse(Object(Predis\Command\KeyScan))
#3 /src/app/vendor/predis/predis/src/Client.php(331): Predis\Connection\AbstractConnection-&gt;executeCommand(Object(Predis\Command\KeyScan))
#4 /src/app/vendor/predis/predis/src/Client.php(314): Predis\Client-&gt;executeCommand(Object(Predis\Command\KeyScan))
#5 /src/app/index.php(14): Predis\Client-&gt;__call('scan', Array)
#6 {main}
  thrown in <b>/src/app/vendor/predis/predis/src/Connection/AbstractConnection.php</b> on line <b>155</b><br />

Not sure where I should start looking for a solution to this issue.

@erikdubbelboer
Copy link
Owner

It basically says it can't connect to tcp://host.docker.internal:6380.
Make sure Redis is running on the same machine on port 6380 outside of Docker.
If you run Redis in Docker as well you'll probably have to use docker-compose to start both inside the same network and use the container hostname to connect to instead of host.docker.internal.

@JESii
Copy link
Author

JESii commented Jul 13, 2022

Thanks...
First off, I'm running through an ssh tunnel, so Redis is on the other side of the tunnel and exposing port 6380.
Second, the following works to start rediscommander thru the tunnel

docker run --rm \
  -p 8181:8081 \
  -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
  -e REDIS_HOST=host.docker.internal \
  -e REDIS_PORT=6380 \
  -e REDIS_TLS=true \
  -e REDIS_PASSWORD=$1 \
  rediscommander/redis-commander:latest

so I can't figure out what's causing phpRedisAdmin to fail... I'll keep trying things, but any insight you have would be most appreciated.

@erikdubbelboer
Copy link
Owner

Could it be that you have the SCAN command disabled? It is trying to execute this command and the error happens when receiving the response. Otherwise I have no idea how to help you further.

Side note: What is the benefit of using phpRedisAdmin over redis-commander? It seems like redis-commander has more features and is being actively developed.

@JESii
Copy link
Author

JESii commented Jul 14, 2022 via email

@erikdubbelboer
Copy link
Owner

Sounds like you have a lot of keys in your Redis. These kinds of admin interfaces are more for smaller instances or for during development.
To maintain some production system with a lot of keys I would always just use the CLI interface.
I heard some good things about https://www.redsmin.com/ in the past, but I have never used it myself.

@JESii
Copy link
Author

JESii commented Jul 15, 2022 via email

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

2 participants