[URGENT] Store procedure cause Net packets out of order

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Justmade
Posts: 108
Joined: Sat 16 Aug 2008 03:51

[URGENT] Store procedure cause Net packets out of order

Post by Justmade » Tue 22 Feb 2011 07:26

The problem is very similar with this thread :
http://www.devart.com/forums/viewtopic.php?t=19693

But this time, TMyQuery without Autoprepare or even TMyStoreProc cause

Project Project1.exe raised exception class EMySqlException with message '
ReceiveHeader: Net packets out of order: received[26], expected[1]'.

When Execute the store procedure and do ANY other database operation afterwards. It seems the store procedure had left some package not handled so the next operation will have incorrect packages.

You can reproduce the problem using the following simple sample.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, MemDS, DBAccess, MyAccess;

type
TForm1 = class(TForm)
con1: TMyConnection;
SP1: TMyStoredProc;
Button1: TButton;
tbl1: TMyTable;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
SP1.Execute;
tbl1.Open;
end;

end.
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 290
ClientWidth = 554
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 80
Top = 152
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object con1: TMyConnection
Database = 'test'
Port = 3306
Username = 'root'
Password = 'XXXXX'
Server = 'localhost'
Connected = True
LoginPrompt = False
Left = 36
Top = 40
end
object SP1: TMyStoredProc
StoredProcName = 'sel_from_emp'
Connection = con1
SQL.Strings = (
'CALL sel_from_emp()')
Left = 252
Top = 100
CommandStoredProcName = 'sel_from_emp'
end
object tbl1: TMyTable
TableName = 'emp'
Connection = con1
Left = 344
Top = 104
end
end
As it had broken some functionality of my programmes, I cannot wait for the next release. Can you send me the place need to fix so that I can manually fix my copy of MyDAC source to solve this problem?

Thanks a lot!

MYDAC 6.00.0.4
Delphi 2010
MySQL 5.1.54
email justmade(dot]yau(at]gmail(dot]com

Justmade
Posts: 108
Joined: Sat 16 Aug 2008 03:51

Post by Justmade » Wed 23 Feb 2011 03:14

Please help!

It seems this error is caused by the fix of Disconnected mode / pooling issue

http://www.devart.com/forums/viewtopic.php?t=20022

Using the above sample, if enable disconnected mode and disable pooling, the error disappeared.

If enable both disconnected mode and pooling, the error come back again.

AndreyZ

Post by AndreyZ » Wed 23 Feb 2011 08:29

Hello,

Unfortunately, I cannot reproduce the problem using your sample. Please check that you aren't using sources from previous MyDAC versions, and you don't have any old dcu files. If it doesn't solve the problem, please try composing a complete sample to demonstrate the problem and send it to andreyz*devart*com.

Justmade
Posts: 108
Joined: Sat 16 Aug 2008 03:51

Post by Justmade » Wed 23 Feb 2011 09:57

Thanks AndreyZ.

As you said it do not happen in your side, I checked if I had modified anything in the source code that might be related.

I found that I had add a line of code to MyClasses because I still randomly getting Assertion Error in MyClasses function TMySQLConnection.GetIsClient41 Line 1 (Assert(FMySQLAPI nil);) or AV at the next line after ApplyUpdate (the changed is saved) or sometime after refresh. As all our production use MYSQL 5.0 or 5.1, so I add a line to return false without any checking. It work fine elsewhere and prevent the assertion error, but is the source of this Net packets out of order.

As I roll back this change, the net packets problem disappeared but the assertion error / AV come back.

As those error appeared to be happen randomly, it is hard to create a demo to demonstrate them. I still think it is related to my setting of disconnected mode, cache update and pooling. I know it is hard for you if I cannot clear state how to reproduce the error, so I will try to find the out how to reproduce it accurately and provide more information.

AndreyZ

Post by AndreyZ » Thu 24 Feb 2011 08:51

We are looking forward to hearing from you.

Post Reply