Lost connection to MySQL server during query

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Anfet
Posts: 9
Joined: Mon 26 Aug 2013 08:36

Lost connection to MySQL server during query

Post by Anfet » Mon 23 Sep 2013 08:59

Hi.

I'm getting this error under following conditions:
- Selecting from view, having ~5000 rows.
- FetchALL is false
- FetchRows = 100

Replication:
I open form, it opens query.
I close form immediately (or with small delay. 1-2sec).
Form closes, executing the following code:

Code: Select all

if qEditor.Fetching then qEditor.BreakExec;
qEditor.Close;
Form closes successfully, and after a second I get this error.

Error is appearing in bot "design"/"run-time", both "debug" and "release", both ide/standalone running.

Any idea how to solve it?

AndreyZ

Re: Lost connection to MySQL server during query

Post by AndreyZ » Mon 23 Sep 2013 14:30

Hello,

In this case the 'Lost connection to MySQL server during query' error is an internal UniDAC error that is used for internal purposes. Such UniDAC behaviour is correct, it is caused by specificity of working with not fetched data. You will see the 'Lost connection to MySql server during query' error only if you run your application from IDE. You will not see this error when you run the executable file of your application.

Anfet
Posts: 9
Joined: Mon 26 Aug 2013 08:36

Re: Lost connection to MySQL server during query

Post by Anfet » Mon 23 Sep 2013 14:43

But I DO see it in standalone application.
What's to do now?

AndreyZ

Re: Lost connection to MySQL server during query

Post by AndreyZ » Tue 24 Sep 2013 09:02

Please specify the following:
- the exact version of UniDAC. You can learn it from the About sheet of TUniConnection Editor;
- the exact version of your IDE;
- the exact version of MySQL server and client you are using. You can learn it from the Info sheet of TUniConnection Editor.

Anfet
Posts: 9
Joined: Mon 26 Aug 2013 08:36

Re: Lost connection to MySQL server during query

Post by Anfet » Tue 24 Sep 2013 09:07

5.0.1 for Delphi XE3
Server version: 5.5.25a
Client version: 7.0.0 Direct
Embarcadero® RAD Studio XE3 Version 17.0.4770.56661

AndreyZ

Re: Lost connection to MySQL server during query

Post by AndreyZ » Tue 24 Sep 2013 13:31

I cannot reproduce the problem. Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .

Anfet
Posts: 9
Joined: Mon 26 Aug 2013 08:36

Re: Lost connection to MySQL server during query

Post by Anfet » Tue 01 Oct 2013 10:09

Andrey.

I found out a strange behavior.
If you use "select * from xxx", problem arises rare (you have to open/close a query fast).
If you use "select * from xxx where yy is null order by `zz`" the problem appears very frequently. 2 clicks on open/close and vuala.

I've made a small example that demonstrates this.
Where you would like them to be uploaded?

ps. Is russian language acceptable in this forum?

AndreyZ

Re: Lost connection to MySQL server during query

Post by AndreyZ » Tue 01 Oct 2013 13:33

Send your example to andreyz*devart*com .

At this forum, you should use English only. If you want to use Russian language, write your questions at our Russian forum: http://forums.devart.com/ru/viewforum.php?f=29

Anfet
Posts: 9
Joined: Mon 26 Aug 2013 08:36

Re: Lost connection to MySQL server during query

Post by Anfet » Wed 02 Oct 2013 08:58

Okay.

Traced the error to:

MySQLNetUni.pas
Line: 1046

Code: Select all

procedure TMySqlNet.VioRead({$IFDEF CLR}var{performance opt}{$ENDIF} buffer: TValueArr; offset, count: integer);
var
  readed: integer;
begin
  readed := Fvio.Read(buffer, offset, count);
  if readed <> count then
    raise EMySqlException.Create(CR_SERVER_LOST, Fvio.LastError);
end;
I see no "check" for IDE or not.
And quite obvious that this Exception is getting thrown normally as it should.

Anfet
Posts: 9
Joined: Mon 26 Aug 2013 08:36

Re: Lost connection to MySQL server during query

Post by Anfet » Wed 02 Oct 2013 09:11

Okay. Found out the problem :roll:
It was the JvDebugHandler with unchecked "UnhandledExceptionsOnly".

Case closed,
Thank you.

AndreyZ

Re: Lost connection to MySQL server during query

Post by AndreyZ » Wed 02 Oct 2013 12:07

It is good to see that you have found the cause of this problem. If any other questions come up, please contact us.

Post Reply