Lachim / redis

Automatically exported from code.google.com/p/redis
2 stars 0 forks source link

SPOP command has bugs #467

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of Redis you are using, in what kind of Operating System?
2.2.0.  the newest stable release version

What is the problem you are experiencing?
SPOP has bug

What steps will reproduce the problem?
  1) create a set. example  testset="test set 1" "test set 2" "test set 3"
  2) destroy the set
        > MULTI
        > SPOP testset
        > SPOP testset
        > SPOP testset
        > EXEC
  3)  then the redis server will crash

Do you have an INFO output? Please past it here.
  redis server is crash, no INFO output

If it is a crash, can you please paste the stack trace that you can find in
the log file or on standard output? This is really useful for us!

blow is the crash log

[30959] 22 Feb 22:50:02 - DB 0: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:02 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:02 - 1 clients connected (0 slaves), 848288 bytes in use
[30959] 22 Feb 22:50:07 - DB 0: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:07 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:07 - 1 clients connected (0 slaves), 848288 bytes in use
[30959] 22 Feb 22:50:12 - DB 0: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:12 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:12 - 1 clients connected (0 slaves), 848760 bytes in use
[30959] 22 Feb 22:50:17 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:17 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:17 - 1 clients connected (0 slaves), 18446744072212254952 
bytes in use
[30959] 22 Feb 22:50:22 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:22 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:22 - 1 clients connected (0 slaves), 18446744072212254952 
bytes in use
[30959] 22 Feb 22:50:27 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:27 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:27 - 1 clients connected (0 slaves), 18446744072212254952 
bytes in use
[30959] 22 Feb 22:50:32 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:32 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:32 - 1 clients connected (0 slaves), 18446744072212254952 
bytes in use
[30959] 22 Feb 22:50:37 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:37 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:37 - 1 clients connected (0 slaves), 18446744072212254960 
bytes in use
[30959] 22 Feb 22:50:42 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:42 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:42 - 1 clients connected (0 slaves), 18446744072212254960 
bytes in use
[30959] 22 Feb 22:50:47 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:47 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:47 - 1 clients connected (0 slaves), 18446744072212254960 
bytes in use
[30959] 22 Feb 22:50:52 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:52 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:52 - 1 clients connected (0 slaves), 18446744072212254952 
bytes in use
[30959] 22 Feb 22:50:57 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:57 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:50:57 - 1 clients connected (0 slaves), 18446744072212254952 
bytes in use
[30959] 22 Feb 22:51:02 - DB 0: 2 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:02 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:02 - 1 clients connected (0 slaves), 18446744072212255272 
bytes in use
[30959] 22 Feb 22:51:07 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:07 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:07 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:12 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:12 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:12 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:17 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:17 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:17 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:22 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:22 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:22 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:27 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:27 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:27 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:32 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:32 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:32 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:37 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:37 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:37 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:42 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:42 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:42 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:47 - DB 0: 1 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:47 - DB 9: 3 keys (0 volatile) in 4 slots HT.
[30959] 22 Feb 22:51:47 - 1 clients connected (0 slaves), 18446744071912610272 
bytes in use
[30959] 22 Feb 22:51:49 # ======= Ooops! Redis 2.2.0 got signal: -11- =======
[30959] 22 Feb 22:51:49 # redis_version:2.2.0
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:64
multiplexing_api:epoll
process_id:30959
uptime_in_seconds:193
uptime_in_days:0
lru_clock:1918118
used_cpu_sys:0.00
used_cpu_user:0.01
used_cpu_sys_childrens:0.00
used_cpu_user_childrens:0.00
connected_clients:1
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:18446744071912610344
used_memory_human:
used_memory_rss:1683456
mem_fragmentation_ratio:0.00
use_tcmalloc:0
loading:0
aof_enabled:0
changes_since_last_save:8
bgsave_in_progress:0
last_save_time:1298443716
bgrewriteaof_in_progress:0
total_connections_received:1
total_commands_processed:17
expired_keys:0
evicted_keys:0
keyspace_hits:8
keyspace_misses:2
hash_max_zipmap_entries:512
hash_max_zipmap_value:64
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
allocation_stats:6=1,8=11,9=12,10=6,11=2,12=611,13=47,14=32,15=35,16=10793,17=17
,18=8,19=14,20=27,21=4,22=2,23=2,24=756,25=
[30959] 22 Feb 22:51:49 # /lib64/libc.so.6 [0x3c7167046e]
[30959] 22 Feb 22:51:49 # /lib64/libc.so.6 [0x3c7167046e]
[30959] 22 Feb 22:51:49 # /lib64/libc.so.6 [0x3c71672a6c]
[30959] 22 Feb 22:51:49 # /lib64/libc.so.6(__libc_malloc+0x6e) [0x3c71674cde]
[30959] 22 Feb 22:51:49 # ./redis-server(zmalloc+0x27) [0x410c07]
[30959] 22 Feb 22:51:49 # ./redis-server(sdscatvprintf+0x39) [0x40ffb9]
[30959] 22 Feb 22:51:49 # ./redis-server(sdscatprintf+0x86) [0x4100b6]
[30959] 22 Feb 22:51:49 # ./redis-server(genRedisInfoString+0x52f) [0x40d63f]
[30959] 22 Feb 22:51:49 # ./redis-server(infoCommand+0x1b) [0x40d99b]
[30959] 22 Feb 22:51:49 # ./redis-server(call+0x23) [0x40dab3]
[30959] 22 Feb 22:51:49 # ./redis-server(processCommand+0x202) [0x40dd62]
[30959] 22 Feb 22:51:49 # ./redis-server(processInputBuffer+0x54) [0x415d84]
[30959] 22 Feb 22:51:49 # ./redis-server(readQueryFromClient+0x6b) [0x415e4b]
[30959] 22 Feb 22:51:49 # ./redis-server(aeProcessEvents+0x173) [0x40aa23]
[30959] 22 Feb 22:51:49 # ./redis-server(aeMain+0x2e) [0x40ac3e]
[30959] 22 Feb 22:51:49 # ./redis-server(main+0xed) [0x40f7ed]
[30959] 22 Feb 22:51:49 # /lib64/libc.so.6(__libc_start_main+0xf4) 
[0x3c7161d994]
[30959] 22 Feb 22:51:49 # ./redis-server [0x40a019]
Segmentation fault
[xgm@localhost src]$ 

Please provide any additional information below.

Original issue reported on code.google.com by xgmlove...@gmail.com on 23 Feb 2011 at 7:07

GoogleCodeExporter commented 8 years ago
In my test, 2.2.0_RC4 has no this issue.
when use spop using multi command, the redis server 's memory will be consumed, 
then crash because has not enough memory.

Original comment by xgmlove...@gmail.com on 23 Feb 2011 at 7:10

GoogleCodeExporter commented 8 years ago
Thanks, reproduced. This is caused by the fix for correctly replicating SPOP to 
slaves and AOF. Will provide a fix shortly.

Original comment by pcnoordh...@gmail.com on 23 Feb 2011 at 8:01

GoogleCodeExporter commented 8 years ago
The following happened:
* SPOP was not correctly replicated (because it depends on the PRNG).
* This was fixed by morphing the argument list for SPOP to an SREM with the 
popped element as argument.
* In EXEC it is assumed that the argument list is not modified --> conflict.

Pretty lame bug, as you can see ;-)

This is the patch:
https://github.com/pietern/redis/commit/61e254767591198d0cc191c043509d5b573cd526
https://github.com/pietern/redis/tree/2.2-spopmulti

Original comment by pcnoordh...@gmail.com on 23 Feb 2011 at 8:43

GoogleCodeExporter commented 8 years ago
hey thanks for fixing in little time, I'll merge today and ship 2.2.1

Salvatore

Original comment by anti...@gmail.com on 23 Feb 2011 at 12:47

GoogleCodeExporter commented 8 years ago
merged and 2.2.1 released

Original comment by anti...@gmail.com on 23 Feb 2011 at 3:10