Problem... (mysql has gone away..)

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
mmikac
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 02.06.2006, 00:43

Problem... (mysql has gone away..)

Post by mmikac »

I use D7 and latest ZeOS.
Started working on new project, connecting to remote mySQL server...

But, the simplest possible example doesn't work properly. I tried to debug it, but I just cannot understand what is really going on.

I manage to establich ZConnection to server... it's ok.
I use ZQuery to insert some data to the table... But, when I try to post it to server (just simple ExecSQL on ZQuery SQL...) sometimes (at start) it works, but in most cases returns "mySQL server has gone away" exception.

I even tried to check Connection.Connected on ZQuery and Reconnect/Connect if false... However, ZConnection state is not changed! If I try to make Connect, it is immediatelly connected (also, OnDisconnect event doesn't fire, so I think that server is connected! That's why I don't understand why is "gone away" exception here!?)

I tried Ping/PingServer... it seems to work...
I am confused and paused on simplest thing possible...

Anyone with suggestion? What could be wrong?
iLLiCiT
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 27.02.2007, 12:17

Post by iLLiCiT »

i am having the same problems.
I'm using ZEos lib with D7 and Mysql 4.0 connecting using libmysql50.dll
(This is done due to soon-to-come mylsq update reasons).
After some time, the connection is droped with the same error message. I even try to connect before each database action but the error still remains and the connection is offline.
I could use the same version libmysql and mysql but the program will be used on several mysql servers with different version (Ranging from 4.0 to 5.0)

So... any advice?
fcodebue
Junior Boarder
Junior Boarder
Posts: 32
Joined: 05.04.2008, 16:02
Contact:

Post by fcodebue »

I have the some problem only in one customer, with mySQL 5.1.30 installed on windows SBS 2003
any idea to trace it?
Codebue Fabio
P-Soft - http://www.p-soft.biz
Firebird La Comunità Italiana - http://www.firebirdsql.it
GestionaleOpen - http://www.gestionaleopen.org
mith
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 24.03.2009, 20:54

Post by mith »

I have this problem too. My solution is to call Connection.Reconnect before any query (like select, update, etc.) is executed. This is not good solution but work for me.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I've seen this before when the dll version didn't fit with the server version. Difficult to find out what dll's fit to what servers. Are you using a 5.1 dll or one of the older mysql 5 dll's. Normally you should be able to use a 5.1 dll with the mysql5 protocol.

Mark
Image
fcodebue
Junior Boarder
Junior Boarder
Posts: 32
Joined: 05.04.2008, 16:02
Contact:

Post by fcodebue »

mith wrote:I have this problem too. My solution is to call Connection.Reconnect before any query (like select, update, etc.) is executed. This is not good solution but work for me.
ot's really a NOT GOOD solutions...
in my project I have something like 5000 SQL command ;)
Codebue Fabio
P-Soft - http://www.p-soft.biz
Firebird La Comunità Italiana - http://www.firebirdsql.it
GestionaleOpen - http://www.gestionaleopen.org
fcodebue
Junior Boarder
Junior Boarder
Posts: 32
Joined: 05.04.2008, 16:02
Contact:

Post by fcodebue »

mdaems wrote:I've seen this before when the dll version didn't fit with the server version. Difficult to find out what dll's fit to what servers. Are you using a 5.1 dll or one of the older mysql 5 dll's. Normally you should be able to use a 5.1 dll with the mysql5 protocol.

Mark
ok I will insert something to check library (for firebird too )

have you have any idea how I can check dll version?
1. search in path
2. first find check file properties...
3...
Codebue Fabio
P-Soft - http://www.p-soft.biz
Firebird La Comunità Italiana - http://www.firebirdsql.it
GestionaleOpen - http://www.gestionaleopen.org
Merco
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 02.04.2009, 21:47

Post by Merco »

I have the same problem. Only difference is I know what's causing the dreaded "MySQL has gone away" message. The company that runs the MySQL server has set it's "wait timeout varaible" to five minutes (default is 8 hours).
Basically it means that the server will close the connection after five minutes of inactivity. Unfortunately the Zeoslib connection component does not intercept this situation.

So if you have control over your MySQL server check the wait timeout value.

Like Mith said the problem can be triggered by using a reconnect call. But it will be he a hell of a job to implement it. Hopefully someone knows a better solution
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

It's a DLL version problem.
uwwin
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 20.07.2006, 08:39

Post by uwwin »

it's happen because the MySQL server timeout setup is too small, so setup the configuration in my.ini (Windows) or my.conf (Linux)... if you can't setup them, you can check the connection before run Query by

if not (TZConnection.connected) then TZConnection.Connect;


CMIIW
Zeus
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 16.03.2010, 21:08

Post by Zeus »

If you are using Windows, to find out which dll MySQL is using run WhatsRunning from www.whatsrunning.net and select the Processes tab. Scroll down to mysqld.exe then in the right pane expand the Modules tree and look for the dll or .exe that it is using. You can then expand it and look at the File Version. It will also tell you where the dll is located on your drive.

Zeus
Post Reply