Aio: 'Resource Temporarily unavailable'

Amos Waterland apw@us.ibm.com
Mon Jan 13 04:56:00 GMT 2003


On Thu, Jan 09, 2003 at 05:54:25PM +0530, Bourne wrote:
> browsing the aio_suspend code, i have found out that if a timeout is 
> specified to aio_suspend, and if the operation does not finish within 
> the specified time, then ETIMEDOUT is returned which is returned as a 
> 'Resource Temporarily unavailable' error to the user program.
> 
> My question is, if such an error is encountered then is it a valid 
> error( i.e, is it a common occurance ? ) OR is it something which should 
> never happen but has happened  and something in glibc needs to be fixed ?

>From the SuSv3[1]:

  The aio_suspend() function shall fail if:

  [EAGAIN] No asynchronous I/O indicated in the list referenced by list
  completed in the time interval indicated by timeout.

Glibc's implementation is correct.  ETIMEDOUT is not being returned, but
rather -1 is being returned with errno[2] set to EAGAIN (aio_suspend.c,
line 157), as per the standard.

As for a "common occurrence": it will occur any time the worker thread
cannot complete any of the requested I/O operations before the specified
timeout, by definition.  This can happen for a variety of reasons, one
of which is that the system is under heavy I/O load.

Amos Waterland

[1] http://www.opengroup.org/onlinepubs/007904975/functions/aio_suspend.html

[2]
% cat test0042.c
#include <stdio.h>
#include <errno.h>
#include <string.h>

int main( int argc, char **argv )
{
    printf ("EAGAIN: %s\n", strerror (EAGAIN));
    printf ("ETIMEDOUT: %s\n", strerror (ETIMEDOUT));
    return 0;
}
% ./test0042
EAGAIN: Resource temporarily unavailable
ETIMEDOUT: Connection timed out



More information about the Libc-alpha mailing list