Bug #61806 Error "Out of sync with server" when connect in Visual Studio Entitly Framework
Submitted: 9 Jul 2011 14:42 Modified: 9 Aug 2011 21:01
Reporter: Przemysław Kaczmarski Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.4.3 OS:Any
Assigned to: Julio Casal CPU Architecture:Any
Tags: connector, out of sync with server, regression

[9 Jul 2011 14:42] Przemysław Kaczmarski
Description:
In previous version 6.3.7 it was OK, but in version 6.4.3 i get error: "Out of sync with server" when I try connect to database MySQL 5.0.77 on Linux with Visual Studio 2010 - Entitly Framework.

Connect to database MySQL 5.5.12 on Windows server works, but error is when I connect to default database instalation (version 5.0.77) on CentOS/Red Hat

Error appears also when I run compiled program, which use Entitly Framework and connect to MySQL Server 5.0.77 on linux.

How to repeat:
Try to map MySQL Database 5.0.77 (running on Linux) with Entitly Framework on Visual Studio 2010 Professional.
[11 Jul 2011 17:43] Daniel Dekowski
Oh my god... I have been scouring the internet to find solution to this as I was having the exact same problem.  Rolled back from version 6.4.3 to 6.3.7 and it magically works now...
[13 Jul 2011 11:30] Bertrand PIEDECOCQ
I have the same problem with MySQL - 5.0.58 server.

Return to version 6.3.7 of the connector and it's works !
[16 Jul 2011 20:25] Jorge Bastos
Howdy Staff/Reggie,

I was testing 6.4.3 and got stuck with the same problem.
After some tests, it seems to happen ONLY on servers < 5.5 and when FunctionsReturnString=true; exists on the connection string.

Is this problem known/fixed yet on the master branch?

Thanks,
Jorge,
[16 Jul 2011 20:44] Jorge Bastos
After a few more tests if seems to happen with or without FunctionsReturnString=true;

It's only on servers < 5.5
[21 Jul 2011 7:42] Jonathan Wong
Same thing here with Visual Studio 2005. 6.4.3.0 gives "out of sync with server" error, 6.3.7.0 is fine!
[22 Jul 2011 13:44] Kyle Stevens
I'm having the same problem.  Unfortunately, I cannot revert to 6.3.6 or 6.3.7 because of separate bugs so I'm sort of stuck.
[27 Jul 2011 18:08] A Ford
Situation:

Server ver: 5.0.77
Connector ver: 6.4.3
VS 2K5

Getting: Out of Sync with server

Any Fixes coming or near, or is there a workaround?

Thanks
[27 Jul 2011 18:15] A Ford
Can't seem to find ver 6.3.7.0  Anybody have any links?

Thanks
[27 Jul 2011 18:24] A Ford
Never mind... I found the download...
[27 Jul 2011 18:41] A Ford
Just down graded to 6.3.7  and it worked... spent almost 3 hours trying to figure out where I went wrong... gzzzz
[27 Jul 2011 18:43] Kyle Stevens
A Ford, just be careful as 6.3.7 had a problem with Entity Framework too and I had to downgrade to 6.3.6.  I can't find the bug report for it though so I am not sure exactly what it was...
[3 Aug 2011 18:14] Julio Casal
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php

The following steps did not reproduce the issue:
1. Install CentOS 5.6 i386
2. Install and configure MySQL Server 5.0.77 on CentOS 5.6.
3. Create a test schema with a couple of tables in the server.
4. Install Connector/Net 6.4.3 on Windows 7 64 bit.
6. Create a console application in VS 2010.
7. Generate an EF model from the test schema adding all tables.
8. Compile and run a simple query against one of the entities, like: 
            using (TestEntities entities = new TestEntities())
            {
                var results = from a in entities.Authors
                              select a;

                foreach (var author in results)
                {
                    Console.WriteLine(author.name);
                }
            }
9. The console correctly presents all results.

If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.
[3 Aug 2011 19:24] Jorge Bastos
Julio,

I don't agree with your answer.
We all provided enougth information for the bug report.

How to reproduce:

- Setup a MySQL 5.5.x server
- Try to connect with the 6.4.3 version of the connector

It will give you: "Out of sync with server" error.
[3 Aug 2011 19:30] Bertrand PIEDECOCQ
My config is Windows Seven Professionnal.
The bug appears when you create a new database connection in Visual Studio 2010
into the servers window or when the test try to connect to the database.
[4 Aug 2011 9:40] surender m
i got same error when i upgraded my connector from 5.0.7 to 6.4.3.
it is happening at connection.open() part of the code.

exception:
{MySql.Data.MySqlClient.MySqlException: Out of sync with server
   at MySql.Data.MySqlClient.NativeDriver.ReadOk(Boolean read)
   at MySql.Data.MySqlClient.NativeDriver.AuthenticateNew(Boolean reset)
   at MySql.Data.MySqlClient.NativeDriver.Authenticate(Boolean reset)
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at SMParentTransaction.clsDB.ExecuteQry(String strQry) in
[4 Aug 2011 12:51] Julio Casal
Please provide the following details to reproduce this issue:
2. MySQL Server version (some say 5.0, some 5.5, some < 5.5, need to clarify).
3. CentOS version (for server).
4. Windows version (for client).
5. Visual Studio version, including service pack.
6. Target framework.
7. Specific connection string used (credentials not required).
8. Send a small sample Visual Studio solution that will show the issue.
[4 Aug 2011 20:21] Jorge Bastos
Julio,

There's no need for all that stuff.

In my previous post I wrote an error.

Just try to connect to a MySQL server less than 5.5x with 6.4.3 .NET connector, and you'll see the error.
On the previous post I said 5.5+, and that was an error, with the 5.5x version works OK.
[4 Aug 2011 20:26] Julio Casal
I just connected to MySQL Server 5.0.77 (running on CentOS 5.6) from VS 2010 + Connector/Net 6.4.3. I can see the database tables from server explorer, generate an EF model and open connections to the server from a console application. No errors at all. 

If you can provide me the requested info I might be able to reproduce your scenario.
[5 Aug 2011 9:06] Jorge Bastos
Sample project, connect to a < 5.5x server

Attachment: out of sync problem.zip (application/zip, text), 216.33 KiB.

[5 Aug 2011 9:11] Jorge Bastos
sample screenshot

Attachment: outofsync.JPG (image/jpeg, text), 144.95 KiB.

[5 Aug 2011 9:12] Jorge Bastos
Julio,

Here's what you want!
You have the sample and a simple screenshot.

It's irrelevant the use of vs2008 or vs2010. in the case it's a vs2008 project in vb.net.
[5 Aug 2011 15:40] Julio Casal
Out of Sync - Cannot Reproduce

Attachment: OutOfSyncNoRepro.jpg (image/jpeg, text), 130.50 KiB.

[5 Aug 2011 15:43] Julio Casal
As you can see in the attached image, your sample project does not reproduce the issue by itself.

Please provide the following details to try to reproduce the issue:
1. CentOS version (for server).
2. Windows version (for client).
[5 Aug 2011 16:06] Jorge Bastos
CentOS ? Have no idea what that is!

MySQL server is 5.1.58 (running on a Debian machine).
.NET connector is 6.4.3, the exact same one that is on my sample project.
[5 Aug 2011 16:31] Julio Casal
Jorge, which is your Debian version? Also, I believe you execute your application on Windows XP?
[5 Aug 2011 17:09] Jorge Bastos
Julio,
Yes, running the app from XP.

The important is the MySQL version, not quite the OS running on it.. but OK.
It's Debian using SID repositories.

If you setup a MySQL 5.1.58 on a windows machine, the problem is the same.
[5 Aug 2011 17:49] Julio Casal
Jorge, just executed your sample against my local MySQL 5.1.58 and it runs just fine. Still need to test with Windows XP (I'm setting up a VM now).

Can you get C/Net 6.4.3 source code and start a debug session? If so, would you place a breakpoint on the start of the MySql.Data.MySqlClient.NativeDriver.ReadOk method? Would you tell me what value does the marker variable get when the following block gets executed?

if (read)
    packet = stream.ReadPacket();
byte marker = (byte) packet.ReadByte();
if (marker != 0)
{
    throw new MySqlException("Out of sync with server", true, null);
}
[5 Aug 2011 20:47] Jorge Bastos
Debug1

Attachment: sync2.jpg (image/jpeg, text), 386.82 KiB.

[5 Aug 2011 20:48] Jorge Bastos
Julio,

Check the image I attached. I changed some source code to make the value of marker appear.

--
throw new MySqlException("marker=> " + marker + "    Out of sync with server", true, null);
--

What do you need more?
[6 Aug 2011 12:42] Dennis C
I'm having the same issue when trying to make a new connection on a win2k3 visual studio 2010 machine to a brinkster.com linus-based mysql database.

Going to downgrade now.
[6 Aug 2011 12:44] Dennis C
spelling error :) connection to a linux machine.

I'm using the server explorer "add connection" function and getting the error when trying to test the connection
[8 Aug 2011 15:29] Julio Casal
Jorge, a value of 255 means there is a server error. Could you enable the MySQL Server Error Log to try to figure out what specific server error you are getting? Documentation on enabling the error log is available here: http://dev.mysql.com/doc/refman/5.1/en/error-log.html
[8 Aug 2011 16:08] Julio Casal
Also, could anybody having this issue share with me their my.ini/my.cnf file or the specific command line parameters used to start mysqld?
[8 Aug 2011 20:00] Jorge Bastos
Julio,

No error at all.

Manual start of MySQL:

Peixe:/var/log/mysql# /usr/sbin/mysqld --basedir=/usr --datadir=/home/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306 --log-error=mysql-error.err &
[1] 31520
Peixe:/var/log/mysql#

Peixe:/home/mysql# tail -f mysql-error.err
110808 20:51:30 [Note] Plugin 'FEDERATED' is disabled.
110808 20:51:30  InnoDB: Initializing buffer pool, size = 8.0M
110808 20:51:30  InnoDB: Completed initialization of buffer pool
110808 20:51:30  InnoDB: Started; log sequence number 0 52300
110808 20:51:30 [Warning] 'user' entry 'root@Peixe2' ignored in --skip-name-resolve mode.
110808 20:51:30 [Note] Event Scheduler: Loaded 0 events
110808 20:51:30 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.58-1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Debian)

--
runned the application, it gave the out of sync error, but nothing else was written to the error log file.
--

^C
Peixe:/home/mysql#
[8 Aug 2011 20:05] Jorge Bastos
my.cnf file

Attachment: my.cnf.txt (text/plain), 4.23 KiB.

[8 Aug 2011 20:06] Julio Casal
Jorge, what about the General Query Log? Can you try that one?
http://dev.mysql.com/doc/refman/5.1/en/query-log.html

Also, could you share your my.ini/my.cnf or your mysqld command line parameters?
[8 Aug 2011 21:02] Jorge Bastos
Julio,

my "my.cnf" is attached.
Tell me, can you talk private by email with me? I'll setup remote access for you to this machine, this is a test VM so there's no problem about that.
[9 Aug 2011 6:41] Steve Mettraux
Same problem with Connector 6.4.3 with a server 5.0.41  running on a Windows2003R2 Server (VM)...
Steve
[9 Aug 2011 6:43] Steve Mettraux
The error log indicates :
"110809  8:30:49 [Warning] Aborted connection 8030 to db: 'mydb' user: 'myuser' host: 'myipaddress' (Got an error reading communication packets)"
[9 Aug 2011 21:01] Julio Casal
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

Fixed in 6.4.4+.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[20 Sep 2011 14:24] Ernesto Carrea
FWIW, I can add the problem is not with 5.1 server version. I have a bunch of clients connecting to 4 different MySQL servers and the problem only shows on one of the 4 servers:

MySQL 5.1.58 on Fedora 14/64 -- Out of sync with server
MySQL 5.1.53 on OpenSUSE 11.4/64 -- OK
MySQL 5.5.15 on Windows/32 -- OK
MySQL 5.5.14 on Fedora 15/64 -- OK

The problem is not with Visual Studio either, as my clients run stand alone (although they are compiled in debug config and the pdb files are deployed).

My 2 cents.
[20 Sep 2011 15:00] Jorge Bastos
Ernesto,

This is already fixed in trunk.
The problem was when the password was in the old password() format. (the tiny hash)
[29 Feb 2012 21:21] John Russell
Added to changelog for 6.4.4: 

An error out of sync with server could occur when connecting in the
Visual Studio Entity Framework. The issue occurred only on some MySQL
servers, all with versions earlier than MySQL 5.5.