InnoDB: Error: io_setup () failedwithEAGAINafter5attempt

Source: Internet
Author: User
Start Multiple MySQL instances on one server using the backup files of each database as data files for SQLReview. No problem before running (up to 23 MyS

Start Multiple MySQL instances on one server using the backup files of each database as data files for SQL Review. No problem before running (up to 23 MyS

Start Multiple MySQL instances on one server using the backup files of each database as data files for SQL Review.
There was no problem before running (up to 23 MySQL instances run simultaneously). Later, a new server was configured and the corresponding instance failed to start.

Some error logs are as follows:
......
140505 16:05:59 InnoDB: Using Linux native AIO
140505 16:05:59 InnoDB: Warning: io_setup () failed with EAGAIN. Will make 5 attempts before giving up.
InnoDB: Warning: io_setup () attempt 1 failed.
InnoDB: Warning: io_setup () attempt 2 failed.
InnoDB: Warning: io_setup () attempt 3 failed.
InnoDB: Warning: io_setup () attempt 4 failed.
InnoDB: Warning: io_setup () attempt 5 failed.
140505 16:06:02 InnoDB: Error: io_setup () failed with EAGAIN after 5 attempts.
InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my. cnf
140505 16:06:02 InnoDB: Fatal error: cannot initialize AIO sub-system
140505 16:06:02 [ERROR] Plugin 'innodb' init function returned error.
140505 16:06:02 [ERROR] Plugin 'innodb' registry as a storage engine failed.
140505 16:06:02 [ERROR] Unknown/unsupported storage engine: InnoDB
......

The Error log shows that the earliest Error occurred was InnoDB: Error: io_setup () failed with EAGAIN after 5 attempts.
This io_setup () failed with EAGAIN is the key.

Let's take a look at io_setup.
NAME
Io_setup-Create an asynchronous I/O context
......
DESCRIPTION
Io_setup () creates an asynchronous I/O context capable of logging ing at least maxevents. ctxp must not point to an AIO context that already exists, and must be
Initialized to 0
Prior to the call. On successful creation of the AIO context, * ctxp is filled in with the resulting handle.
RETURN VALUE
Io_setup () returns 0 on success; otherwise, one of the errors listed in the "Errors" section is returned.
ERRORS
EINVAL ctxp is not initialized, or the specified maxevents exceeds internal limits. maxevents shocould be greater than 0.
EFAULT An invalid pointer is passed for ctxp.
ENOMEM Insufficient kernel resources are available.
EAGAIN The specified maxevents exceeds the user's limit of available events.
ENOSYS io_setup () is not implemented on this architecture.
CONFORMING
......
We can see that io_setup is used to create an asynchronous I/O Context Environment for specific purposes. The error code EAGAIN indicates that the specified maxevents exceeds the limit of available events for users.
A large number of MySQL instances have been run on the server, and the resource for creating asynchronous I/O has reached the critical point. Therefore, the startup of the new instance fails.

Finally, the problem is solved by adding -- innodb_use_native_aio = 0 to start the MySQL instance.


You can also solve this problem by changing system settings (to be verified ).
Cat/proc/sys/fs/aio-max-nr: The current aio-max-nr value is usually 65536 (64 K)

You can change the value of the file by following these steps (the file cannot be edited directly)
Sudo vim/etc/sysctl. conf
Modify or add
Fs. aio-max-nr = 262144 (k)

Run the command to modify/proc/sys/fs/aio-max-nr.
Sysctl-p

We can see that the value in/proc/sys/fs/aio-max-nr has changed.
Cat/proc/sys/fs/aio-max-nr

Restart a MySQL instance

This problem can also be avoided by modifying the mysql source code, but it is generally not recommended or necessary to do so.

Startup, shutdown, and restoration of the InnoDB Storage Engine

MySQL InnoDB independent tablespace Configuration

Architecture of MySQL Server layer and InnoDB Engine Layer

InnoDB deadlock Case Analysis

MySQL Innodb independent tablespace Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.