benluteijn / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Slave crash on master shutdown #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Configure master/slave
2. send shutdown command to master
3. connection to slave is broken, slave crashes with following call stack

17 Dec 17:20:37 * ======= Ooops! Redis 1.02 got signal: -11- =======
17 Dec 17:20:37 * redis_version:1.02; uptime_in_seconds:99; 
connected_clients:1; connected_slaves:0; used_memory:10319260; 
changes_since_last_save:0; bgsave_in_progress:0; last_save_time:1261070338; 
total_connections_received:1; total_commands_processed:1; role:slave;
17 Dec 17:20:37 * /lib/libc.so.6(+0x320c0) [0x7f6dc02330c0]
17 Dec 17:20:37 * 2 redis-server 0x407b09 infoCommand + 345
17 Dec 17:20:37 * 3 redis-server 0x409399 processCommand + 409
17 Dec 17:20:37 * 4 redis-server 0x40b323 readQueryFromClient + 451
17 Dec 17:20:37 * /usr/bin/redis-server(aeProcessEvents+0x1c8) [0x403bb8]
17 Dec 17:20:37 * /usr/bin/redis-server(aeMain+0x1d) [0x403e8d]
17 Dec 17:20:37 * /usr/bin/redis-server(main+0x67b) [0x40ceab]
17 Dec 17:20:37 * /lib/libc.so.6(__libc_start_main+0xfd) [0x7f6dc021fb6d]
17 Dec 17:20:37 * /usr/bin/redis-server() [0x403179]

What is the expected output? What do you see instead?

Slave should process in the absence of a listening master

What version of the product are you using? On what operating system?

Redis 1.02 on Linux akatz64 2.6.30-ARCH #1 SMP PREEMPT Fri Jul 31 07:30:28 
CEST 2009 x86_64 Intel(R) Xeon(R) CPU E5440 @ 2.83GHz GenuineIntel 
GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by aryehk...@gmail.com on 17 Dec 2009 at 5:24

GoogleCodeExporter commented 9 years ago
Hello, can't reproduce this with Redis 1.1.x, I think some bug was fixed in the 
meantime and this bug is no longer affecting Redis head.

For instance there is a bug that makes the slave crash if the INFO command is 
called 
while it's not connected to the master, and from the stack trace I can see the 
problem 
was around the info commnad. Maybe you have some script calling INFO against 
the 
no longer connected slave?

Cheers,
Salvatore

Original comment by anti...@gmail.com on 18 Dec 2009 at 10:14

GoogleCodeExporter commented 9 years ago
Tried today - you are correct. The slave loops with 
"
18 Dec 16:15:55 * Unable to connect to MASTER: Connection refused
18 Dec 16:15:56 - Connecting to MASTER...
"

until an INFO is sent to master, in which case the salve crashes.

Attached is a patch against 1.02 which solves this issue (Tested and no longer 
crashes when info is called).

This is after the master has been shutdown but slave is still alive:

>>> r.info()
{u'total_connections_received': 1, u'connected_clients': 1, 
u'master_link_status':
u'down', u'used_memory': 5209, u'master_last_io_seconds_ago': 0, u'master_host':
u'tsavanna64', u'db0': u' keys=1,expires=0', u'total_commands_processed': 1,
u'changes_since_last_save': 0, u'role': u'slave', u'uptime_in_seconds': 10,
u'uptime_in_days': 0, u'master_port': 6379, u'connected_slaves': 0,
u'bgsave_in_progress': 0, u'last_save_time': 1261153635, u'redis_version': 
u'1.02'}

Original comment by kata...@gmail.com on 18 Dec 2009 at 4:30

Attachments:

GoogleCodeExporter commented 9 years ago
thanks,

given that's already fixed in 1.2.0-rc4 I think I'll not fix 1.0.x about this, 
we are very 
near to 1.2.0-stable. If 1.2 will delay maybe I'll do another 1.0 release.

Original comment by anti...@gmail.com on 18 Dec 2009 at 6:10

GoogleCodeExporter commented 9 years ago

Original comment by anti...@gmail.com on 23 Aug 2010 at 4:17