From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3H9K-0004J9-C7 for qemu-devel@nongnu.org; Mon, 30 Nov 2015 00:37:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3H9H-0005Yh-5S for qemu-devel@nongnu.org; Mon, 30 Nov 2015 00:37:18 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:45043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3H9G-0005WN-IT for qemu-devel@nongnu.org; Mon, 30 Nov 2015 00:37:15 -0500 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Nov 2015 15:37:09 +1000 Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id DA28C2BB0051 for ; Mon, 30 Nov 2015 16:37:07 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAU5b0iU34078792 for ; Mon, 30 Nov 2015 16:37:09 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAU5aYq7004367 for ; Mon, 30 Nov 2015 16:36:35 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAU5aY1M003719 for ; Mon, 30 Nov 2015 16:36:34 +1100 Received: from tungsten.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 74E96A01D7 for ; Mon, 30 Nov 2015 16:35:40 +1100 (AEDT) Date: Mon, 30 Nov 2015 16:34:47 +1100 From: Sam Bobroff Message-ID: <20151130053447.GA24435@tungsten.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] Question about nonblocking stderr and lost logs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi QEMU programmers, While doing some experimental work on QEMU that has involved adding a lot of new log messages (using qemu_log_mask()), I've discovered that under some conditions a lot of my log messages go missing. I've tracked the issue down to qemu_logfile being left at the default (stderr) (so when not using -D) and according to strace what is happening is that the debug messages are being passed to write() but write() is returning EWOULDBLOCK and the messags are dropped. This seems to be happening because stderr is being set non-blocking (which is a bit odd to me), and it seems like NONBLOCK is being set as qmp_chardev_add() adds a device for stdout (yes stdout, not stderr; perhaps file descriptors have been dup'd by that point?). Is this by design to prevent a slow console from blocking QEMU? If not, should I delve further and try to prevent non-blocking being set on stderr? (Unfortunately I don't have a replication for this using an unmodified QEMU but I suspect I could find one if necessary.) Cheers, Sam.