Bug #71173 MySQL 5.7.3 InnoDB multiple errors: 'chsize' returned OS error 71
| Submitted: | 18 Dec 2013 14:57 | Modified: | 25 Feb 2014 17:55 |
|---|---|---|---|
| Reporter: | Oscar González | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S2 (Serious) |
| Version: | 5.7.3 | OS: | Windows (Windows 7 Enterprise 64-bit) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | 5.7.3, chsize, error log, innodb, OS error 71, truncate | ||
[18 Dec 2013 14:57]
Oscar González
[23 Dec 2013 14:00]
Oscar González
Hello guys! Any news?
[27 Jan 2014 15:07]
Oscar González
Hello again, Is anybody going to take a look at this, or maybe not? Thanks, OscarG.
[27 Jan 2014 19:30]
Shane Bester
I'm guessing the error is that _open_osfhandle fails. The limit of C runtime file descriptors is 2048 minus a few for already open files. I will try repeat this by creating >2048 innodb tables with large enough table cache... and truncate them all
[3 Feb 2014 13:20]
Shane Bester
Today I spontaneously encountered this error. Version: '5.7.4-m14' socket: '' port: 3306 MySQL Community Server (GPL) 2014-02-03T13:19:05.262278Z 1 [ERROR] InnoDB: Operating system error number 2 in a file operation. 2014-02-03T13:19:05.262778Z 1 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 2014-02-03T13:19:05.262778Z 1 [ERROR] InnoDB: File .\test\blobtest_4.ibd: 'chsize' returned OS error 71. 2014-02-03T13:19:05.262778Z 1 [ERROR] InnoDB: Cannot truncate file .\test\blobtest_4.ibd in TRUNCATE TABLESPACE. 2014-02-03T13:19:05.267779Z 3 [ERROR] InnoDB: Operating system error number 2 in a file operation. 2014-02-03T13:19:05.268279Z 3 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 2014-02-03T13:19:05.268279Z 3 [ERROR] InnoDB: File .\test\blobtest_3.ibd: 'chsize' returned OS error 71. 2014-02-03T13:19:05.268279Z 3 [ERROR] InnoDB: Cannot truncate file .\test\blobtest_3.ibd in TRUNCATE TABLESPACE. 2014-02-03T13:19:05.279280Z 2 [ERROR] InnoDB: Operating system error number 2 in a file operation. 2014-02-03T13:19:05.279280Z 2 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 2014-02-03T13:19:05.279780Z 2 [ERROR] InnoDB: File .\test\blobtest_3.ibd: 'chsize' returned OS error 71. 2014-02-03T13:19:05.279780Z 2 [ERROR] InnoDB: Cannot truncate file .\test\blobtest_3.ibd in TRUNCATE TABLESPACE. 2014-02-03T13:19:05.292782Z 3 [ERROR] InnoDB: Operating system error number 2 in a file operation. 2014-02-03T13:19:05.293282Z 3 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 2014-02-03T13:19:05.293282Z 3 [ERROR] InnoDB: File .\test\blobtest_5.ibd: 'chsize' returned OS error 71. 2014-02-03T13:19:05.293282Z 3 [ERROR] InnoDB: Cannot truncate file .\test\blobtest_5.ibd in TRUNCATE TABLESPACE. 2014-02-03T13:19:05.327286Z 1 [ERROR] InnoDB: Operating system error number 2 in a file operation.
[3 Feb 2014 13:34]
Shane Bester
The handle from _open_osfhandle is not being closed in os_file_truncate!
[3 Feb 2014 16:45]
Shane Bester
Seems hard to repeat this again. All I have now is ever-increasing "handles" according to task manager. But no more errors... I'll leave it running longer.
[3 Feb 2014 18:04]
Shane Bester
The problem is two-fold.
_open_osfhandle is failing and we don't check for that.
The actual error from that CRT function is this:
if ( (fh = _alloc_osfhnd()) == -1 ) {
errno = EMFILE; /* too many open files */
_doserrno = 0L; /* not an OS error */
return -1; /* return error to caller */
}
So on a debug build, we get CRT assertion as expected:
Version: '5.7.4-m14-debug' socket: '' port: 3306 MySQL Community Server (GPL)
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\chsize.c(55) : Assertion failed: (filedes >= 0 && (unsigned)filedes < (unsigned)_nhandle)
Then, _chsize is receiving a fd of -1, which is invalid.
Testcase for windows:
---------------------
drop procedure if exists p1;
drop table if exists t1;
create table t1(a longblob)engine=innodb;
delimiter $
create procedure p1()
begin repeat
truncate t1; insert into t1 values (repeat('a',1000000));
until 1=2 end repeat; end $
delimiter ;
call p1(); #run in two threads
[3 Feb 2014 18:08]
Shane Bester
I'd think we shouldn't be using c runtime file descriptors/functions such as _open_osfhandle anymore. but I don't know an easy Win32 API replacement to _chsize!
[25 Feb 2014 18:29]
Shane Bester
Fixed as of 5.7.4, and here's the changelog entry: "TRUCATE TABLE" on Windows would report multiple "'chsize' returned OS error 71" errors. Thank you for the bug report.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.065 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.