Bug #24786 | Command timeout does not raise exception, documentation incorrect | ||
---|---|---|---|
Submitted: | 4 Dec 2006 4:28 | Modified: | 11 Feb 2011 10:29 |
Reporter: | John Vanderburg | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 5.0.2 | OS: | Windows (Windows XP SP2) |
Assigned to: | Tony Bedford | CPU Architecture: | Any |
Tags: | CommandTimeout, Docs |
[4 Dec 2006 4:28]
John Vanderburg
[4 Dec 2006 12:03]
Tonci Grgin
Hi John and thanks for your problem report. Can you please try to repeat with latest version available.
[4 Dec 2006 16:52]
John Vanderburg
Tonci, thanks for the response. I believe I already have the latest version. By the way, here are some details I left out: Client: Windows XP SP2, .NET 2.0 Server: Linux/Fedora Core 4, MySQL server 5.0.27-standard via TCP/IP While researching the problem yesterday, I uninstalled the copy of 5.0.2 I had and downloaded and installed new copy from the mysql.com website. I looked at the install file on both copies and the create date was November 3 2006 9:13 AM. If there is a newer version, please let me know where I can find it. I've compiled a debug version using the source and will do some more testing. I want to make 100% that it isn't a problem with poor exception handling on my end. I don't think it is but you know how that goes. I'll let you know what I find out. It may not be until tomorrow as things are getting busy here. Thanks again.
[5 Dec 2006 7:52]
Tonci Grgin
John, you can use sources from subversion repository at http://svn.mysql.com/svnpublic/connector-net. You will need SVN tool like TortoiseSVN to get to it. In "branches" you'll find latest 1.0 code and in "trunk" 5.0 code. "Tags" contain released versions. I'm waiting on your feedback.
[5 Dec 2006 14:50]
John Vanderburg
Tonci, Here is what I was able to determine during testing: 1. The TimeoutExpired delegate in command.cs (line 318) is called if the command takes longer than CommandTime to execute. 2. cmd.timedOut is set to true and cmd.Cancel called to kill the query. At this time you can see the command disappear in the MySql Administrator. 3. After thatI wasn't able to follow the exact sequence of events due to the threading; however, I could tell that no exceptions were being raised after that point. 4. Since no exceptions are raised, the timeout exception at line 393 is never thrown. Thanks for the information on the sources. I'll check to see if this has been addressed in the latest development versions.
[8 Dec 2006 9:18]
Tonci Grgin
Hi John. We actually have 2 problems here: 1. Docs not reflecting commandTimeout defaulting to 30 2. TimeOut error not thrown From what I see catch (MySqlException ex) { // if we caught an exception because of a cancel, then just return null if (ex.Number == 1317) { if (timedOut) throw new MySqlException(Resources.Timeout); return null; } throw; } ex.Number == 1317 is never satisfied because connection went dead... Test case is pretty simple, just break execution in debugger or with MessageBox and wait. I will have to investigate this more.
[8 Dec 2006 15:23]
John Vanderburg
Tonci: I exported the sourcs from the trunk of the SVN repository and it appeared that this specific code had not changed. For some reason I never see any exception raised, so I never got as far as if( ex.Number == 1317) check. Thanks for your help. I almost never use CommandTimeout, so I've set it to 0 and am able to use the connector without any issues. I guess the documentation being wrong turned out to be a good thing in this case, as I wouldn't have found the bug in the first place. Good luck on finding the bug. Please let me know if you need any more information. If I happen to do more debugging and find out anything new I'll let you know. Thanks agian.
[13 Dec 2006 16:07]
Tonci Grgin
Verified on two points: 1. Docs not reflecting commandTimeout defaulting to 30 2. TimeOut error *never* thrown. (ex.Number == 1317) condition is never satisfied because connection went dead, as from what I see in debugger. Test case is pretty simple, just break execution in debugger or with MessageBox and wait.
[2 May 2007 13:33]
Randall Carlson
Just to add another confirmation on this. As of 5.0.6 this problem has not been resolved. I am running Connector/NET on a Windows 2003 Server along with SharePoint 2007. From what I read, does setting CommandTimeout to 0 bypass the issue?
[2 May 2007 14:35]
Tonci Grgin
Hi Randall. It works for me, at least in 5.0.7. Thanks for your interest in MySQL.
[8 May 2007 10:55]
Randall Carlson
Do you know where OR when I can get 5.0.7? It hasn't been released yet.
[8 May 2007 20:51]
Reggie Burnett
Not able to verify as a bug. Please be aware that the timeout only occurs when using a non debug build of the library and that it only occurs when you are connecting to a mysql host of version 5.0 or later.
[10 May 2007 13:56]
Randall Carlson
So this is NOT a bug? I am connecting to a MySQL 5.0.18 database, so what are my options? My ASP.NET application is failing because I cannot trap the timeout exception coming from Connector/NET. I need to be able to handle the timeout exception and display a user-friendly error message.
[10 May 2007 14:03]
Tonci Grgin
Randall, I'm still following this report. We'll see how your problem will be resolved.
[11 May 2007 4:27]
Reggie Burnett
Randall I'm saying that I can't reproduce it using 5.0.7 (which should be released in the next day or two).
[16 May 2007 16:48]
Randall Carlson
I got an advanced copy of 5.0.7 and tested my code against it. According to the thread above, there appears to be a timeout problem. When I execute a query that exceeds the default 30 sec period, my code traps a MySqlException with number 1028 and a message "Sort aborted". Not sure that this is the correct error, but I can use it for my purposes. At least now it is handling an exception.
[16 May 2007 18:31]
Tonci Grgin
Randall, this is a rare error and usually caused by no space in TMPDIR or by bad disk or RAM. Can you check on that and get back to us?
[24 Oct 2008 2:15]
MySQL Verification Team
Documentation still does not list a default value for default command timeout in the table at http://dev.mysql.com/doc/refman/5.0/en/connector-net-examples-mysqlconnection.html#connect... command.cs sets 30 as the default
[9 Dec 2008 7:48]
Tonci Grgin
Tony, please document this according to last remark from Scott.
[11 Feb 2011 10:29]
Tony Bedford
The documentation on this was reorganized and updated some time ago. Default Command Timeout is clearly documented (with default value) on this page: http://dev.mysql.com/doc/refman/5.1/en/connector-net-connection-options.html