From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 1 20:11:28 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 558B8106566C; Sun, 1 Jul 2012 20:11:28 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id 37FC58FC08; Sun, 1 Jul 2012 20:11:28 +0000 (UTC) Received: from eagle.yuri.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id q61KBHiw052865; Sun, 1 Jul 2012 13:11:20 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <4FF0AEE1.5040607@rawbw.com> Date: Sun, 01 Jul 2012 13:11:13 -0700 From: Yuri User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120625 Thunderbird/13.0.1 MIME-Version: 1.0 To: Adrian Chadd References: <4FEE0D2F.4010808@rawbw.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jul 2012 20:11:28 -0000 On 07/01/2012 08:57, Adrian Chadd wrote: > I haven't yet done digging to see if poll() is returning the xorg > socket as being ready. I think that's worth doing. > > And it's a huge problem for battery consumption.:) For simple qt4 apps, reads in question originate from libxcb from _xcb_in_read function. I tried to replace read with poll in there but poll just blocks: //int n = read(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len); struct pollfd fds = {c->fd, POLLIN|POLLERR|POLLHUP, INFTIM}; int n = poll(&fds, 1, INFTIM); poll hangs during the third call in simple test app, because poll_for_response is called during XFlush when it is nothing to actually read. So some of libX11 code should be changed to only call poll when response is expected. Otherwise it looks like poll indeed returns xorg socket as being ready. Yuri