[sheepdog] [PATCH] sheep: fix clear_client crash

Liu Yuan namei.unix at gmail.com
Tue Jul 10 10:37:23 CEST 2012


On 07/10/2012 11:42 AM, Liu Yuan wrote:
> On 07/09/2012 08:50 PM, Yunkai Zhang wrote:
>> We should use list_for_each_entry_safe instead of list_for_each_entry
>> to loop when we need to delete node in it.
> 
> I still get following segfault occasionally
> 
> #0  0x00007f76753ddba5 in raise (sig=<value optimized out>) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1  0x00007f76753e16b0 in abort () at abort.c:92
> #2  0x00007f767541765b in __libc_message (do_abort=<value optimized
> out>, fmt=<value optimized out>)
>     at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
> #3  0x00007f76754216d6 in malloc_printerr (action=3, str=0x7f76754f2362
> "corrupted double-linked list", ptr=<value optimized out>)
>     at malloc.c:6283
> #4  0x00007f7675424ae7 in _int_free (av=0x7f7675729e40, p=0x12e5670) at
> malloc.c:4964
> #5  0x00007f7675427ea3 in __libc_free (mem=<value optimized out>) at
> malloc.c:3738
> #6  0x00000000004090a1 in free_request (req=0xed0fa0) at sdnet.c:474
> #7  0x0000000000409a04 in clear_client (ci=0xed0e70) at sdnet.c:687
> #8  0x0000000000409d92 in client_handler (fd=21, events=29,
> data=0xed0e70) at sdnet.c:765
> #9  0x000000000041e2dc in event_loop (timeout=-1) at event.c:179
> #10 0x0000000000404376 in main (argc=7, argv=0x7fffa742edd8) at sheep.c:275
> 

This bug can be occasionally produced by following script:

==============
#!/bin/bash

pkill -9 sheep
pkill -9 collie
rm store/* -rf
for i in `seq 0 7`; do sheep/sheep -d /home/tailai.ly/sheepdog/store/$i
-z $i -p $((7000+$i));done
for ((;;)); do
        if [ $(collie/collie node list | wc -l) -ne 9 ]; then
		sleep 1
        else
		break
        fi
done
collie/collie cluster format -c 3
collie/collie cluster info

for i in `seq 0 4`;do
	collie/collie vdi create test$i 100M -p 7000
done

echo begin write
for i in `seq 0 4`;do
dd if=/dev/urandom | collie/collie vdi write test$i -p 7000 &
done

echo begin kill
for i in `seq 1 5`; do pkill -f "sheep/sheep -d
/home/tailai.ly/sheepdog/store/$i -z $i -p 700$i";sleep 3;done;
for i in `seq 1 5`; do sheep/sheep -d /home/tailai.ly/sheepdog/store/$i
-z $i -p $((7000+$i));done

echo wait for object recovery to finish
for ((;;)); do
        if [ "$(pgrep collie)" ]; then
                sleep 1
        else
                break
        fi
done

for i in `seq 0 7`; do
	for j in `seq 0 4`; do
		./collie/collie vdi read test$j -p 700$i | md5sum
	done
done



More information about the sheepdog mailing list