Bug #90296 Hard error should be report when fsync() return EIO.
Submitted: 4 Apr 1:59 Modified: 9 Apr 18:58
Reporter: Allen Lai Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.23 OS:Any
Assigned to: CPU Architecture:Any

[4 Apr 1:59] Allen Lai
Description:
when fsync() returns EIO it should be treated as a hard error and InnoDB must abort immediately.
fsync() will just return EIO only once when the IO error happens, so, it's wrong to keep trying to call it till it return success.

https://stackoverflow.com/questions/42434872/writing-programs-to-cope-with-i-o-errors-caus...

How to repeat:
it can be reproduce by gdb.

Suggested fix:
We need to modify the error handling in function os_file_fsync_posix

....
		case EIO:

			++failures;
			ut_a(failures < 1000);

			if (!(failures % 100)) {

				ib::warn()
					<< "fsync(): "
					<< "An error occurred during "
					<< "synchronization,"
					<< " retrying";
			}

			/* 0.2 sec */
			os_thread_sleep(200000);
			break;
.....
[9 Apr 18:58] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.23, 8.0.12  release, and here's the changelog entry:

An I/O error returned by an fsync() operation is now treated as a hard
error.