From owner-freebsd-stable@FreeBSD.ORG Thu May 3 15:06:29 2007 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE01816A409 for ; Thu, 3 May 2007 15:06:29 +0000 (UTC) (envelope-from pvh@wfeet.za.net) Received: from ctb-mesg-1-3.saix.net (ctb-mesg-1-3.saix.net [196.25.240.81]) by mx1.freebsd.org (Postfix) with ESMTP id 4711613C469 for ; Thu, 3 May 2007 15:06:29 +0000 (UTC) (envelope-from pvh@wfeet.za.net) Received: from leftside.wfeet.za.net (dsl-241-51-150.telkomadsl.co.za [41.241.51.150]) by ctb-mesg-1-3.saix.net (Postfix) with ESMTP id E0891133D2; Thu, 3 May 2007 17:06:21 +0200 (SAST) Received: from leftside.wfeet.za.net (localhost [127.0.0.1]) by leftside.wfeet.za.net (Postfix) with ESMTP id 9DE4230161; Thu, 3 May 2007 17:06:13 +0200 (SAST) X-Spam-Virus: No X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on leftside.wfeet.za.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 Received: from [192.168.0.1] (blackstar.wfeet.za.net [192.168.0.1]) by leftside.wfeet.za.net (Postfix) with ESMTP id 86CC03015F; Thu, 3 May 2007 17:06:13 +0200 (SAST) Message-ID: <4639FA65.7010005@wfeet.za.net> Date: Thu, 03 May 2007 17:06:13 +0200 From: Peter van Heusden User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: "Mirror of cups.bugs Newsgroup" , freebsd-stable@freebsd.org References: <5560-cups.bugs@news.easysw.com> <5561-cups.bugs@news.easysw.com> In-Reply-To: <5561-cups.bugs@news.easysw.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (leftside.wfeet.za.net [0.0.0.0]); Thu, 03 May 2007 17:06:13 +0200 (SAST) Cc: Subject: Re: [cups.bugs] tcgetattr() causes lockup in USB backend on FreeBSD6-STABLE X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2007 15:06:29 -0000 Sorry, a bit more investigation revealed that my earlier comments were wrong. Yes, the tcgetattr() call *does* "hang" - on my system it takes 10 seconds to return, before returning ENODEV (the only thing that ioctl on a ulpt returns on FreeBSD, according to my reading of the kernel). That, however, isn't the real problem - the real hang occurs when backendRunLoop() in runloop.c tries to read backchannel data from the ulpt - despite select() saying that there is data available, the read() blocks (I've even tried making the read buffer's size 1 byte, the problem persists). This causes the usb backend hang. So indeed, setting use_bc = 0 solves the problem. I'm not sure why select() / read() interact like this. Peter Michael Sweet wrote: > Peter van Heusden wrote: > >> I recently upgrade CUPS on my FreeBSD 6-STABLE server to version 1.2.10, >> and it took a while to get the USB backend working (I have a USB-connect >> HP LaserJet 1010). After some debugging, it turned out that the code in >> usb-unix.c that calls tcgetattr() on /dev/ulptN in print_device() was at >> fault - what happens is that tcgetattr() blocks, and the USB backend >> then hangs. I'm still waiting for a response from the FreeBSD developers >> on this behaviour, but in any event from my reading of the kernel it >> seems that ioctl() on a FreeBSD ulpt is a no-op anyway. >> > > The use_bc stuff doesn't control whether ioctl() (via tcget/setattr) > is used to set "raw" mode, so a separate fix will be needed. > > That said, this sounds like a serious FreeBSD bug - ioctl is needed > for POSIX conformance on all character devices. > >