Red Hat Bugzilla – Bug 172757
aio_suspend hangs when file I/O
Last modified: 2007-11-30 17:07:21 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Description of problem:
After The parent process has called lio_listio()/aio_suspend/aio_return to read/write file ,fork a child proces by fork() .when called lio_listio()/aio_suspend/aio_return to read/write the same file int the child process,
the aio_suspend hangs . gdb back trace is the following:
#0 0xa000000000010641 in ?? ()
#1 0x20000000002f71d0 in __lll_lock_wait () from /lib/tls/libpthread.so.0
#2 0x20000000002f1b60 in pthread_cond_signal@@GLIBC_2.3.2 ()
#3 0x200000000022ceb0 in pthread_cond_signal@@GLIBC_2.3.2 ()
#4 0x2000000000049230 in __aio_enqueue_request () from /lib/tls/librt.so.1
#5 0x200000000004ba30 in lio_listio64 () from /lib/tls/librt.so.1
#6 0x4000000000001990 in main (argc=4, argv=0x60000fffffffba68)
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. run testaio liang 100 100 in attachment file.
Notice a testaio was testaio.c by "gcc -g testaio.c -o testaio -lrt
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DFORK"
b liang is not exist file.
Actual Results: the expected "end wait" has been output to stdout and the child process hangs
Expected Results: end wait has been output and the program can normally exit
Created attachment 120834 [details]
aio_suspend test program which can reproduce aio_suspend hangs
compile method is the follow :
gcc -g testaio.c -o testaio -lrt -D_LARGEFILE64_SOURCE -_FILE_OFFSET_BITS=64
lio_listio implies multi-threaded process. And in a multi-threaded process
you are not allowed to call almost any function after fork (except
async-signal-safe functions), see
So you can't e.g. call lio_listio there, as it is not async-signal-safe.
Thanks a lot. It is understood.
In Red Hat is there other asynchronous I/O function ?
Just aio_* and lio_*. It really depends on what exactly you want to do.
Either use a thread instead of forking, or exec a child program and do the
work in there.