Lost connection

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Lost connection

Post by GEswin » Wed 16 Feb 2005 16:44

I'm experiencing a lot of Lost Connection problems. It' always raised at this point from MySqlNet.pas

Code: Select all

  if not FCompress then begin
    if Fvio.Read(buffer, offset, count)  count then
      raise EMySqlException.Create(CR_SERVER_LOST);
  end
---------------------------
Debugger Exception Notification
---------------------------
Project UcmcW.exe raised exception class EMyError with message 'Lost connection to MySQL server during query'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
It happens quite a lot just when connecting. I'm using latest mydac and mysql 4.1.8 under Linux.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 17 Feb 2005 07:32

Most probably, some of your queries is executed more than 30 seconds. Try to increase a value of CommandTimeout property.

Also possible that by any connection no command was executed for a long time. In this case MySQL Server itself can break a connection. Try to execute MyConnection.Ping once at some time or increase a value of appropriate server variable.

For more details about different reasons of this error occurrence please see MySQL Reference manual http://dev.mysql.com/doc/mysql/en/gone-away.html

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Thu 17 Feb 2005 10:12

It happens quite a lot just when connecting. I'm using latest mydac and mysql 4.1.8 under Linux.
All querys are extremely fast, taking the longest less than 3 seconds. This happens also often just when connecting. I checked log on mysql, when this happens it's connected (In mysql log), and after raising exception it's disconnected from mysql (in mysql log). It happens also between a bunch of sql query's.. we run a process, and between it gets disconnected. I activated logs and found nothing strange.

I'm doing all this in direct mode. Today I'll try using direct set to false.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 18 Feb 2005 10:16

Now we carefully revise an algorithm of transferring compressed data. Probably, we could find a problem but if you send us an example, our task will be greatly simplified.

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Fri 18 Feb 2005 10:51

If it's of any information, i work with compression set to false. I can't send an example, since there is no way to reproduce it. Sometimes it's just when you connect, other times it happens between operations, etc.

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Thu 24 Feb 2005 14:16

I'm working since two days with Direct set to false, and using libmysql.dll v4.1.10 and server 4.1.8 on linux without any lost connection. Seems that the problem is when working directly.

Please check this, there must be some issue that needs to be fixed, and i prefer to work in direct mode.

regards

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 25 Feb 2005 09:56

We carefully revised procedures of forming and check packets and bring them in accord with the state at most close to libmysql. Within several days a new build will be available for download.

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Fri 25 Feb 2005 17:33

I supose that build is not the one announced today.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 02 Mar 2005 07:22

These changes were included at the build 3.50.0.17 that is available for download now.

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Wed 02 Mar 2005 08:42

Ok, i didn't see anything related to this in the history. I've just downloaded it and i'll try today. I'll post my results.

Regards

Thomas Jüntgen

Post by Thomas Jüntgen » Sun 06 Mar 2005 19:51

I tested the build 3.50.0.17 and the error is still the same.
When I try to edit a blob value is it not possible to post due to the error "lost connection"
I use MySQL version 4.1.9 with XP system and C++ Builder 6

Direct property is true, Connection Time is set to 15, but the exception appears in the first second after the post.
The problem is easy to reproduce. The image which I want to insert is a BMP 5,5MB.

Thanks for your help

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Mon 07 Mar 2005 11:05

Hi Thomas Jüntgen
The image which I want to insert is a BMP 5,5MB.
This can be another problem, set

Code: Select all

 max_allowed_packet  = 16M 
in my.cnf , this is the only way to work with big blob's.

I'm testing and for now I didn't get any lost-connection. But still give it another few days, since it didn't occur everyday, just from time to time.

regards

Thomas Jüntgen

Post by Thomas Jüntgen » Mon 07 Mar 2005 12:16

Thanks a lot J.Pieter Vos this solved my problem.

jop
Posts: 8
Joined: Thu 11 Nov 2004 21:12

Post by jop » Thu 10 Mar 2005 22:21

I got the same "Lost connection" when trying to inser a file (14Mb) in a blob field.
I checked the MySQL manual and found info about max_allowed_packet. I was to small.
I did:
set global max_allowed_packet = 1GB;

set session max_allowed_packet= 1GB;

Lost connection problem gone;

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Sun 13 Mar 2005 23:13

These changes were included at the build 3.50.0.17 that is available for download now.
Hi Ikar

Looks like the problem is solved, i've been running applications for a few days both at my computer and at customers, and it looks like the connection lost problem is solved.

Thanks

Post Reply