Bug #40785 Lost connection error in sysbench test on Windows
Submitted: 17 Nov 2008 14:16 Modified: 4 Sep 2014 13:59
Reporter: Alexey Stroganov Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.1.30-win64 OS:Windows (2003 Server)
Assigned to: CPU Architecture:Any
Tags: crash, pushbuild, sporadic, test failure, widespread

[17 Nov 2008 14:16] Alexey Stroganov
Description:
Running sysbench tests on Windows 2003 Server with number of threads > 50-55 I got following error during establishing of connections:

FATAL: error 2013: Lost connection to MySQL server at 'reading initial communication packet', system error: 0

After looking at debug traces we found out that on Windows we are reporting wrong system error. Raw patch below fix this and now we get back correct error number. 

FATAL: error 2013: Lost connection to MySQL server at 'reading initial communication packet', system error: 10054

However reason of such error is still unclear is under investigation.

=== modified file 'sql-common/client.c'
--- sql-common/client.c	2008-03-29 08:02:54 +0000
+++ sql-common/client.c	2008-11-17 12:34:26 +0000
@@ -2111,7 +2111,7 @@
     set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
                              ER(CR_SERVER_LOST_EXTENDED),
                              "waiting for initial communication packet",
-                             errno);
+                             socket_errno);
     goto error;
   }
 
@@ -2125,7 +2125,7 @@
       set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
                                ER(CR_SERVER_LOST_EXTENDED),
                                "reading initial communication packet",
-                               errno);
+                               socket_errno);
     goto error;
   }
   /* Check if version of protocol matches current one */

How to repeat:
1. Download svn version of sysbench: svn co  https://sysbench.svn.sourceforge.net/svnroot/sysbench/

2. Follow steps in README-WIN.txt to build the sysbench.exe binary.

3. Save the following test file as test.lua:

--- cut ---
function event(thread_id)
  db_connect()
  print ("Thread id - " .. thread_id)
  db_disconnect()
  return 1
end
--- cut ---

4. sysbench.exe --num-threads=<50-100> --test=test.lua  --mysql-host=127.0.0.1 --mysql-user=root --mysql-port=3306  --max-requests=0 --max-time=1 --oltp-table-name=test --mysql-db=test run
[5 Sep 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".