From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuhFu-0002dg-CF for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:27:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuhFs-0005Xx-5h for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:27:02 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:42559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuhFr-0005Xn-VY for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:27:00 -0500 Received: by mail-pb0-f48.google.com with SMTP id rq13so2094123pbb.21 for ; Mon, 14 Jan 2013 02:26:59 -0800 (PST) Message-ID: <50F3DD6A.8080000@gmail.com> Date: Mon, 14 Jan 2013 18:26:50 +0800 From: Liu Yuan MIME-Version: 1.0 References: <50F3BEE2.5090802@gmail.com> <20130114102303.GA11988@stefanha-thinkpad.redhat.com> In-Reply-To: <20130114102303.GA11988@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] 100% CPU when sockfd is half-closed and unexpected behavior for qemu_co_send() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org On 01/14/2013 06:23 PM, Stefan Hajnoczi wrote: > On Mon, Jan 14, 2013 at 04:16:34PM +0800, Liu Yuan wrote: >> Hi List, >> This problem can be reproduced by: >> 1. start a sheepdog cluster and create a volume 'test'* >> 2. attach 'test' to a bootable image like >> $ qemu -hda image -drive if=virtio,file=sheepdog:test >> 3. pkill sheep # create a half-closed situation >> >> I have straced it that QEMU is busy doing nonsense read/write() after >> select() in os_host_main_loop_wait(). I have no knowledge of >> glib_select_xxx, so someone please help fix it. > > You mentioned a nonsense read(). What is the return value? > > If you get a read with return value 0, this tells you the socket has > been closed. Can you handle these cases in block/sheepdog.c? > This is what I saw repeatedly: select(25, [3 4 5 8 9 10 13 18 19 24], [], [], {1, 0}) = 2 (in [5 13], left {0, 999994}) read(5, "\6\0\0\0\0\0\0\0", 16) = 8 write(5, "\1\0\0\0\0\0\0\0", 8) = 8 write(5, "\1\0\0\0\0\0\0\0", 8) = 8 write(5, "\1\0\0\0\0\0\0\0", 8) = 8 write(5, "\1\0\0\0\0\0\0\0", 8) = 8 write(5, "\1\0\0\0\0\0\0\0", 8) = 8 write(5, "\1\0\0\0\0\0\0\0", 8) = 8 .... 5 isn't a sockfd that sheepdog uses. I don't know if I can handle it in sheepdog.c because I noticed that there isn't any function called when this happens. So I suspect this should be handle at upper block core. Thanks, Yuan