This problem comes from POSIX_Proactor.cpp, line 970. The default max number of AIO of linux is 1024. By running command "ulimit -n", we can get this value.
The resolution is simple, according to this article. We have to modify several files to break the limit of system.
1. edit /etc/security/limits.conf, set the limit for the user/group who want to break the limit, such as:
... igame soft nofile 4096 igame hard nofile 4096 # End of file
... session required pam_limits.so # end of pam-auth-update config
Next step, we have to modify ACE source code.
1. Edit ace/POSIX_Proactor.h, replace line 36, 37 with the following code:
// igame update the max size to 4096, default size to 1024 //#define ACE_AIO_MAX_SIZE 2048 //#define ACE_AIO_DEFAULT_SIZE 1024 #define ACE_AIO_MAX_SIZE 4096 #define ACE_AIO_DEFAULT_SIZE 2048 #warning("Igame changed the AIO size: max 4096, default 2048")
2. If you think the the "Max Number of AIOs xxxx" really annoy, you can search "ACE_POSIX_AIOCB_Proactor::Max Number of AIOs=%d" in ace/POSIX_Proactor.h and comment the respective lines.
3. make clean && make and then install.
Note if you want to install libACExxx into /usr, you should run "make install" in $ACE_ROOT with root's shell.
Now we can re-compile our program and run it. If we didn't comment the tip, we will get output like this:
(17066 | 140737320802048) ACE_POSIX_AIOCB_Proactor::Max Number of AIOs=2048