I have specified command_timeout for 4 seconds.
But when I run the application, the command takes something about 8-12 seconds before it times out.
I also specified connection timeout in MySQL connection string, but with no luck
default command timeout=4
It works for MsSqll and Oracle well, but for MySQL not.
Is there any way how to specify the timeout?
I found the issue there https://forums.mysql.com/read.php?38,634568,634568 but with no answer.
Code Sample
...
DataTable outputNodes = new DataTable();
Stopwatch sw = new Stopwatch();
cmd.CommandTimeout = 4;
sw.Start();
var a = cmd.ExecuteReader();
sw.Stop();
ex_time = sw.Elapsed;
sw.Reset();
outputNodes.Load(a);
CloseConnection();
...
This is probably a bug in Connector/NET. I've run into a number of bugs with CommandTimeout
, eg, bug 88124 , bug 87307 . I thought I even remembered filing a bug report about MySqlCommand
taking 2× CommandTimeout
before it actually timed out (which sounds like your situation), but I can't find it now (if I actually did file it).
If you have a consistent repro, I'd suggest filing a bug at bugs.mysql.com .
And if you have the flexibility to change drivers, try MySqlConnector , which has a much more robust CommandTimeout
implementation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.