Bug 52795 - Infinite loop on MySqlDataReader.ReadAsync() causing 100% CPU usage - regression
Summary: Infinite loop on MySqlDataReader.ReadAsync() causing 100% CPU usage - regression
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Egorbo
URL:
Depends on:
Blocks:
 
Reported: 2017-02-25 03:33 UTC by Łukasz Domeradzki
Modified: 2017-03-10 20:25 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: Yes
Last known good build: master/17c5a00c5


Attachments
Reproducable case (2.12 MB, application/x-zip-compressed)
2017-02-25 03:33 UTC, Łukasz Domeradzki
Details
screenshot - 100% CPU usage for 30 seconds, no activity from MySQL (65.69 KB, image/png)
2017-02-25 03:34 UTC, Łukasz Domeradzki
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Łukasz Domeradzki 2017-02-25 03:33:50 UTC
Created attachment 19968 [details]
Reproducable case

Steps to reproduce:

1. Install local MySQL server, I used Debian Testing for this
apt-get install mariadb-server

2. Create new "root" user (for testing only!)
mysql -h localhost -u root # No password needed when we're executing this as root, otherwise set password and add -p

CREATE USER 'archi'@'localhost' IDENTIFIED BY 'testpass';
GRANT ALL PRIVILEGES ON *.* TO 'archi'@'localhost' WITH GRANT OPTION;
exit

3. Reproduce the bug
xbuild /p:Configuration=Release
mono Mono-Bug/bin/Release/Mono-Bug.exe


Expected result:
OK, reproducing now
Could not reproduce, all good!

Bad result:
OK, reproducing now
<infinite loop>


Maybe it's easier to reproduce this bug without a hassle of installing MySQL, but if you get an exception instead then you won't be able to reproduce it - we get to infinite loop the moment mysqlDataReader.ReadAsync() is executed.

I have no idea whether this is specific to MySQL library for C# or other System.Data readers too - all I know is that it worked just fine, and got broken as a regression recently. Last knows good build is my self-compiled Mono JIT compiler version 4.9.1 (master/17c5a00c5 Wed 15 Feb 04:43:13 CET 2017). First bad build is the one from a few days ago (21? 22?), so some commit between 15-22 Feb.
Comment 1 Łukasz Domeradzki 2017-02-25 03:34:17 UTC
Created attachment 19969 [details]
screenshot - 100% CPU usage for 30 seconds, no activity from MySQL
Comment 2 Łukasz Domeradzki 2017-02-25 03:42:44 UTC
Just for a reference, I was reproducing this with Mono JIT compiler version 4.9.1 (master/17c5a00c5, 25th Feb 04:43 CET), I forgot to add mono --version to a screenshot, sorry.
Comment 3 Łukasz Domeradzki 2017-02-25 03:44:21 UTC
I mean, last good build was master/17c5a00c5, first bad build is master/655ac68c, sorry, I promise I won't spam your inbox more, I need to rush those bug reports less... :|

Thank you in advance for looking into this!
Comment 4 Alexander Köplinger [MSFT] 2017-02-26 15:57:43 UTC
Hey Egor, this looks like it might be caused by your CoreFX System.Data changes, could you please take a look?
Comment 5 Łukasz Domeradzki 2017-03-10 20:24:32 UTC
This was fixed in https://github.com/mono/mono/pull/4383 - please correct status of the bug report if I didn't choose appropriate options, thanks!
Comment 6 Łukasz Domeradzki 2017-03-10 20:25:02 UTC
I mean, fixed in https://github.com/mono/mono/pull/4504 (zzz...)