Page 1 of 1

Lost connection to MySQL server during query

Posted: Mon 23 Sep 2013 08:59
by Anfet
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?

Re: Lost connection to MySQL server during query

Posted: Mon 23 Sep 2013 14:30
by AndreyZ
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.

Re: Lost connection to MySQL server during query

Posted: Mon 23 Sep 2013 14:43
by Anfet
But I DO see it in standalone application.
What's to do now?

Re: Lost connection to MySQL server during query

Posted: Tue 24 Sep 2013 09:02
by AndreyZ
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.

Re: Lost connection to MySQL server during query

Posted: Tue 24 Sep 2013 09:07
by Anfet
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

Re: Lost connection to MySQL server during query

Posted: Tue 24 Sep 2013 13:31
by AndreyZ
I cannot reproduce the problem. Please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .

Re: Lost connection to MySQL server during query

Posted: Tue 01 Oct 2013 10:09
by Anfet
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?

Re: Lost connection to MySQL server during query

Posted: Tue 01 Oct 2013 13:33
by AndreyZ
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

Re: Lost connection to MySQL server during query

Posted: Wed 02 Oct 2013 08:58
by Anfet
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.

Re: Lost connection to MySQL server during query

Posted: Wed 02 Oct 2013 09:11
by Anfet
Okay. Found out the problem :roll:
It was the JvDebugHandler with unchecked "UnhandledExceptionsOnly".

Case closed,
Thank you.

Re: Lost connection to MySQL server during query

Posted: Wed 02 Oct 2013 12:07
by AndreyZ
It is good to see that you have found the cause of this problem. If any other questions come up, please contact us.