From owner-freebsd-current Sun Mar 10 23:45:45 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id DA5C137B419; Sun, 10 Mar 2002 23:45:40 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id SAA09014; Mon, 11 Mar 2002 18:45:38 +1100 Date: Mon, 11 Mar 2002 18:46:54 +1100 (EST) From: Bruce Evans X-X-Sender: To: Robert Watson Cc: Subject: Re: b_to_q to a clist with no reserved cblocks In-Reply-To: Message-ID: <20020311182801.A5653-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 10 Mar 2002, Robert Watson wrote: > Just noticed the following for the first time today? (a) b_to_q console > message, and (b), the truncated 'Mar' which presumably has to do with > syslogd getting killed, some buffer getting flushed, or the like. The > b_to_q thing is what I'm wondering about. > > # reboot > Mar 10 18:36:39 reboot: rebooted by root > Mar 10 18:36:39 reboot: rebooted by root > Mar 10 18:36:39 reboot: rebooted by root > b_to_q to a clist with no reserved cblocks. > MarWaiting (max 60 seconds) for system process `vnlru' to stop...stopped > Waiting (max 60 seconds) for system process `bufdaemon' to stop...stopped > Waiting (max 60 seconds) for system process `syncer' to stop...stopped > > syncing disks... > done > Uptime: 16m12s Truncation at "Mar" is caused by ttymsg() not caring that its messages actually get written. Many messages may be truncated. I normally saw several "N"'s in a row when I debug this last November. That meant that several messages starting with "November" were truncated to "N". ttymsg() checks the result of writev() and is more careful if writev() returns EWOULDBLOCK, but for non-synchronous ttys like serial ttys, writev() normally just buffers the data and it takes a tcdrain() to ensure that the data has at least been transmitted. Unfortunately, there is no way to determine if the data has been transmitted without blocking, and ttymsg() doesn't want to block. ttymsg() compounds the error by using non-blocking mode in most cases. When non-blocking mode is in effect at last-close time, it tells close() to discard the data instead of blocking. The last-close sometimes occurs in exit() when blocking in it is very inconvenient because it gives an unkillable (half dead already) process. When writev() returns EWOULDBLOCK, ttymsg() switches to blocking mode and can generate a horde of blocked or unkillable children. I don't know exactly what causes the b_to_q message. It is most likely a race in close. You can first-open tty's that are blocked in last-close, and having this open succeed is very important for unblocking the close usi9ng "comcontrol /dev/foo drainwait ", but the tty system doesn't seem to do nearly enough to handle races here. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message