question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Receiving extra connection/disconnection events on Redis server shutdown

See original GitHub issue

Bug 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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yissacharcommented, Aug 19, 2018

Got it, async is working fine for me.

Still confused as to the multiple events though. Is this expected or not?

0reactions
mp911decommented, Aug 20, 2018

Yes, multiple events are expected. See Connection-Events.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found