From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH qemu-traditional] qemu: Fix race condition when binding ports Date: Mon, 9 Dec 2013 13:25:55 +0000 Message-ID: <52A5C4E3.9070402@citrix.com> References: <1386594652-6953-1-git-send-email-andrew.cooper3@citrix.com> <52A5C2E6.3080005@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52A5C2E6.3080005@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: Stefano Stabellini , Ian Jackson , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org On 09/12/13 13:17, George Dunlap wrote: > On 12/09/2013 01:10 PM, Andrew Cooper wrote: >> Two Qemus can race to bind the same VNC port. It is valid for multiple >> listen()s on the same socket to succeed, but only the first bind() will >> succeed. >> >> In the case that two Qemus are racing, the second one will fail with an >> EADDRINUSE, and bail with a fatal error which renders the domain >> functionally >> useless. >> >> In the case that bind() fails with EADDRINUSE, rebind the socket >> again and try >> for the next port. > > Sorry if I'm being a bit dense here, but it looks like you have those > mixed up: if listen() fails with EADDRINUSE, you're going back to call > bind() again; which would suggest that you can have multible bind()s > but only a single listen()? Or am I confused? Nope - very definitely me who messed up the message. v2 on its way. ~Andrew