NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/45334: aio(3) fails with more than request when one of them blocks, or, aio(3) is only asychnornous for one single request



>Number:         45334
>Category:       kern
>Synopsis:       aio(3) fails with more than request when one of them blocks, 
>or, aio(3) is only asychnornous 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
>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@localhost:/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.



Home | Main Index | Thread Index | Old Index