From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNRlJ-00018W-AI for qemu-devel@nongnu.org; Tue, 11 Mar 2014 14:50:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNRlA-0004nv-P5 for qemu-devel@nongnu.org; Tue, 11 Mar 2014 14:50:49 -0400 Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]:45535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNRlA-0004nh-Hy for qemu-devel@nongnu.org; Tue, 11 Mar 2014 14:50:40 -0400 Received: by mail-ee0-f45.google.com with SMTP id d17so3922099eek.4 for ; Tue, 11 Mar 2014 11:50:39 -0700 (PDT) Date: Tue, 11 Mar 2014 19:50:36 +0100 From: Stefan Hajnoczi Message-ID: <20140311185036.GC512@stefanha-thinkpad.redhat.com> References: <1394532550-21857-1-git-send-email-marcel.a@redhat.com> <1394532550-21857-2-git-send-email-marcel.a@redhat.com> <20140311124022.GA7761@stefanha-thinkpad.redhat.com> <1394542311.3981.37.camel@localhost.localdomain> <1394543062.3981.41.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1394543062.3981.41.camel@localhost.localdomain> Subject: Re: [Qemu-devel] [PATCH V2 1/2] tests/libqtest: Fix possible deadlock in qtest initialization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcel.a@redhat.com Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, aliguori@amazon.com, afaerber@suse.de On Tue, Mar 11, 2014 at 03:04:22PM +0200, Marcel Apfelbaum wrote: > On Tue, 2014-03-11 at 14:51 +0200, Marcel Apfelbaum wrote: > > On Tue, 2014-03-11 at 13:40 +0100, Stefan Hajnoczi wrote: > > > On Tue, Mar 11, 2014 at 12:09:09PM +0200, Marcel Apfelbaum wrote: > > > > @@ -78,12 +79,16 @@ static int socket_accept(int sock) > > > > struct sockaddr_un addr; > > > > socklen_t addrlen; > > > > int ret; > > > > + struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT, > > > > + .tv_usec = 0 }; > > > > + > > > > + setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout, > > > > + sizeof(timeout)); > > > > > > > > addrlen = sizeof(addr); > > > > do { > > > > ret = accept(sock, (struct sockaddr *)&addr, &addrlen); > > > > } while (ret == -1 && errno == EINTR); > > > > - g_assert_no_errno(ret); > > > > close(sock); > > > > > > Did you mean to leave SO_RCVTIMEO set after this function completes? > > Yes, I don't think it hurts. A 5 sec timeout should be like infinite, > > Qemu running on the same machine. If you think > ... otherwise, I can remove the timeout, but I think it is OK. I think you are right. I checked that the qtest protocol has no long-running operations. It doesn't seem realistic that any qtest command would take 5 seconds or longer. So let's leave in the timeout. Stefan