NetBSD Problem Report #45334

From www@NetBSD.org  Tue Sep  6 07:59:25 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 1572B63C7A8
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  6 Sep 2011 07:59:25 +0000 (UTC)
Message-Id: <20110906075924.66A3F63C789@www.NetBSD.org>
Date: Tue,  6 Sep 2011 07:59:24 +0000 (UTC)
From: mbalmer@netbsd.org
Reply-To: mbalmer@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: aio(3) fails with more than request when one of them blocks, or, aio(3) is only asychnornous for one single request
X-Send-Pr-Version: www-1.0

>Number:         45334
>Category:       kern
>Synopsis:       aio(3) fails with more than request when one of them blocks, or, aio(3) is only asynchronous for one single request
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 06 08:00:00 +0000 2011
>Last-Modified:  Tue Sep 06 08:09:20 +0000 2011
>Originator:     Marc Balmer
>Release:        5.99.55
>Organization:
TNF
>Environment:
NetBSD amd64.vnode.ch 5.99.55 NetBSD 5.99.55 (GENERIC) #19: Sun Sep  4 11:58:36 CEST 2011  root@amd64.vnode.ch:/usr/obj/amd64/sys/arch/amd64/compile/GENERIC amd64

>Description:
When more than one aio requests are enqueued and one of them blocks, all other requests are blocked.
>How-To-Repeat:
do an aio_read() on a listened/accepted socket and a second one on a file or tty.  The second one will only finish once the request on the socket has finished.

The underlying problem is that aio(3) puts all requests in a single queue and only one worker thread looping over this queue.  So if a request blocks, the worker thread will not process to the next request until the blocking request returns.


>Fix:
aio requests should be handled in parallel, maybe with a proper thread for each request or some other mechanism.

A simple approach could be to set the filedescriptors internally to nonblocking and have the worker thread skip the request if it would block.

>Release-Note:

>Audit-Trail:

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.