Received: from eggs.gnu.org ([140.186.70.92]:44110) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfVNR-0007o1-3w for qemu-devel@nongnu.org; Sat, 09 Jul 2011 07:07:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QfVNQ-0007xA-3Y for qemu-devel@nongnu.org; Sat, 09 Jul 2011 07:07:13 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:32821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfVNP-0007vc-Tl for qemu-devel@nongnu.org; Sat, 09 Jul 2011 07:07:12 -0400 Message-ID: <4E183654.5010501@msgid.tls.msk.ru> Date: Sat, 09 Jul 2011 15:07:00 +0400 From: Michael Tokarev MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] failed migration makes monitor stuck List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel After some debugging I found a programming error in error handling in migration, but I'm not sure how to fix it. When migration starts, monitor gets suspended, calling monitor_suspend() routine which increments assotiated suspend_cnt counter. At the end of migration, in migrate_fd_cleanup(), monitor_resume() gets called, which decrements the counter. But monitor_resume() gets also called from another place, in migrate_fd_put_buffer(), in case we encountered a write error. So, suppose a tcp endpoint has disconnected, or the exec: program terminated due to error or whatnot -- in all these cases write will fail, and we'll call monitor_resume() twice as a result: once in this place in migrate_fd_put_buffer(), and once more at the end in migrate_fd_cleanup(). This results in suspend_cnt being decremented twice, with the resultant value being -1. So monitor_can_read() will return 0 from now on, since it compares suspend_cnt with 0. And hence, monitor will stop working. To me it looks like monitor_resume() call should be removed from migrate_fd_put_buffer(), but I'm not sure _why_ it were here in the first place. There's more: monitor_suspend() gets called from within protocol handlers (using migrate_fd_monitor_suspend() routine), -- are we sure that all current and future protocol handlers will call this function? Thanks! /mjt