Receiving extra connection/disconnection events on Redis server shutdown
See original GitHub issueBug Report
Current Behavior
I’m trying to use the connection events to listen for when a connection has been made or lost and take appropriate actions. However, I often get extra connection/disconnection events that I don’t think should exist.
1. DisconnectedEvent [/127.0.0.1:55964 -> localhost/127.0.0.1:6379]
2. ConnectionDeactivatedEvent [/127.0.0.1:55964 -> localhost/127.0.0.1:6379]
Aug 07, 2018 4:20:42 PM io.lettuce.core.protocol.ConnectionWatchdog run
INFO: Reconnecting, last destination was localhost/127.0.0.1:6379
Aug 07, 2018 4:20:42 PM io.lettuce.core.protocol.ReconnectionHandler lambda$null$1
INFO: Reconnected to localhost:6379
3. ConnectedEvent [/127.0.0.1:55967 -> localhost/127.0.0.1:6379]
4. ConnectionActivatedEvent [/127.0.0.1:55967 -> localhost/127.0.0.1:6379]
5. DisconnectedEvent [/127.0.0.1:55967 -> localhost/127.0.0.1:6379]
6. ConnectionDeactivatedEvent [/127.0.0.1:55967 -> localhost/127.0.0.1:6379]
I am running Redis in Docker and just cycle through killing the container and restarting. The above logs are a for a single docker stop <container>
command. You can see I get an additional event of each type after the initial disconnect events. This doesn’t happen every time I kill the container, but it happens very frequently.
Input Code
RedisClient redisClient = RedisClient.create("redis://localhost:6379");
redisClient.getResources().eventBus().get().subscribe(System.out::println);
redisClient.connect();
Expected behavior/code
I should only receive a disconnect event when the Redis server is shutdown instead of additional connection events.
Environment
- Lettuce version(s): 5.0.5.RELEASE
- Redis version: 4.0.10
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Stop redis server. Neither shutdown nor stop works
The normal way of doing this is to connect to a client like redis-cli and execute "shutdown" command. I've found some issues trying...
Read more >Redis replication
Connect to the Redis port while the server is doing some work and issue the SYNC command. You'll see a bulk transfer and...
Read more >Lettuce Reference Guide
The command references explains Redis commands and contains links to getting started guides, reference documentation and tutorials.
Read more >WebSockets - FastAPI
But it's the simplest way to focus on the server-side of WebSockets and have ... With that you can connect the WebSocket and...
Read more >python-websockets(1) - Arch manual pages
In this first part, you will create a server and connect one browser; ... in order to receive game events and doing nothing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got it, async is working fine for me.
Still confused as to the multiple events though. Is this expected or not?
Yes, multiple events are expected. See Connection-Events.