Bug #55629 5.5.x goes into infinite loop and high cpu after error flushing io cache

Submitted: 29 Jul 2010 16:34 Modified: 1 Dec 2010 17:45
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Windows Severity:S1 (Critical)
Version:5.5.5 OS:Windows (xp)
Assigned to: Vladislav Vaintroub CPU Architecture:Any
Tags: regression

[29 Jul 2010 16:34] Shane Bester
Description:
This case of an error is a huge read_buffer_size, and OS gives a failure.
So, this query spins/hangs when it should return an error and quit:

---------+------+-----------+-----------------------------------------------------
 Command | Time | State     | Info
---------+------+-----------+-----------------------------------------------------
 Query   |  282 | executing | select repeat('a',@@global.read_buffer_size) into ou
 Query   |    0 | NULL      | show processlist
---------+------+-----------+-----------------------------------------------------

For this specific failure, filemon shows us:

18:27:09.453	mysqld.exe:3588	IRP_MJ_WRITE 	\\xp64\h$\outddd.txt	INSUFFICIENT RESOURCES	Offset: 0 Length: 134219775	
18:27:09.453	mysqld.exe:3588	FASTIO_WRITE	H:\outddd.txt	FAILURE	Offset: 0 Length: 134219775	

5.1.49 gave an error and didn't hang, which is friendly:
ERROR 3 (HY000): Error writing file '\\xp64\h$\outddds.txt' (Errcode: 22)

How to repeat:
start server like this:

mysqld.exe --no-defaults --console --skip-gr --skip-na --max-allowed-packet=1G 
--read-buffer-size=128M

make sure there exists some usable windows share, and run a query to save a file into it:

select repeat('a',@@global.read_buffer_size) 
into outfile '\\\\xp64\\h$\\outddd.txt'
[5 Oct 2010 10:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/119969

3092 Vladislav Vaintroub	2010-10-05
      Bug#55629 5.5.x goes into infinite loop and high cpu after
      error flushing io cache 
      
      The reason for the error was incorrect return code from
      my_win_write() in case of error on 64 bit Windows.
      
      Error should be  indicated by return code 
      (size_t)-1 == 2^64 -1, but due to cast it was
      (DWORD)-1 = 2^32 -1
      
      The caller of this function would fail to recognize the error
      and continue looping.
      
      Fix is to return correct error code (size_t)-1 in case of error
      as expected by caller.
      
      Also minimal cleanup is done : my_win_write() now uses
      the same parameter checks  as related functions (0 and
      overflow handling for count parameterr).
[5 Oct 2010 12:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/119988

3092 Vladislav Vaintroub	2010-10-05
      Bug#55629 5.5.x goes into infinite loop and high cpu after
      error flushing io cache 
      
      The reason for the error was incorrect return code from
      my_win_write() in case of error on 64 bit Windows.
      
      Error should be  indicated by return code 
      (size_t)-1 == 2^64 -1, but due to cast it was
      (DWORD)-1 = 2^32 -1
      
      The caller of this function would fail to recognize the error
      and continue looping.
      
      Fix is to return correct error code (size_t)-1 in case of error
      as expected by caller.
      
      Also minimal cleanup is done : my_win_write() now uses
      the same parameter checks  as related functions (0 and
      overflow handling for count parameter).
[6 Oct 2010 11:40] Vladislav Vaintroub
queued to 5.5-bugteam, trunk-merge
[9 Nov 2010 19:43] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (merge vers: 5.5.7-rc) (pib:21)
[13 Nov 2010 16:10] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:29] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (pib:21)
[1 Dec 2010 17:45] Tony Bedford
An entry has been added to the 5.5.7 changelog:

        The server entered an infinite loop with high CPU utilization
        after an error occurred during flushing of the IO cache.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.061 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.