ZeosDBO & multithreading safely
Posted: 30.08.2011, 15:24
Hello Zeos Folks,
I want to know the community's general opinion about ZeosDBO (6.6.6 stable) and multiple threads.
I have several threads each with its own ZConnection and ZQuery created dynamically, and have static ZConnection and ZQuery components put on the main form also.
After several hours of flawless running once the ZQuery on the static ZConnection throws an Invalid pointer operation on an Open; call, then some time later again (or List index out of bounds (4)), and things start to get worse and worse, tons of AccessViolations, until the app crashes with EOutOfMemory. All coming from Zeos. It looks like the static ZQuery or ZConnection has been freed abnormally, or its address being changed somewhere out of my sight (I hope not the last ... ).
Exception logs :
Eurekalog call stack WITH ZEOS CODE LINE NUMBERS :
(btw. how to widen the code window ?)
I suspect there are some global variables ZConnection or ZQuery uses that are not thread-safe. Or I lack some essential information that's Zeos specific and needed to run ZComponents multithreadedly safely.
I've already implemented TCriticalSection as I found it best.
These errors did not exist before I put Zeos in threads.
On the first sight I wonder the community's general suggestion about Zeos and threads, does anybody have experience pushing a DB server to its limits successfully this way ?
Thanks for any comments.
Cheers,
Peter
ps. I am on: Delphi 5; MSSQL 2005; Win2003 Server
I want to know the community's general opinion about ZeosDBO (6.6.6 stable) and multiple threads.
I have several threads each with its own ZConnection and ZQuery created dynamically, and have static ZConnection and ZQuery components put on the main form also.
After several hours of flawless running once the ZQuery on the static ZConnection throws an Invalid pointer operation on an Open; call, then some time later again (or List index out of bounds (4)), and things start to get worse and worse, tons of AccessViolations, until the app crashes with EOutOfMemory. All coming from Zeos. It looks like the static ZQuery or ZConnection has been freed abnormally, or its address being changed somewhere out of my sight (I hope not the last ... ).
Code: Select all
TMyZQuery = class(TZQuery)
private
procedure BeforeOpenHandler(DataSet: TDataSet);
public
constructor Create(AOwner: TComponent); override;
procedure ExecSQL; override;
end;
constructor TMyZQuery.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
BeforeOpen:=BeforeOpenHandler;
end;
procedure TMyZQuery.ExecSQL;
begin
if Assigned(BeforeOpen) then BeforeOpen(Self);
if IniParams.Database.ProtectQueries then
try
DatabaseRWCriticalSection.Enter;
inherited ExecSQL;
finally
DatabaseRWCriticalSection.Leave;
end
else inherited ExecSQL;
end;
{$B-}
procedure TMyZQuery.BeforeOpenHandler(DataSet: TDataSet);
begin
if IniParams.Log.Database and (DataSet.ClassName='TMyZQuery') then FileLog(DatabaseAll,Linearize((DataSet as TZQuery).SQL.Text));
end;
Code: Select all
procedure TGPRSConn.FTPLoadCommands;
var c,h: integer; FTPMode: TFTPMode; QueryText: string; Query: TMyZQuery; t: Double;
begin
h:=0; t:=Now;
try
Query:=TMyZQuery.Create(MainModule);
with Query do try
h:=1;
Connection:=MainModule.ZConnection2;
h:=2;
SQL.Add('SELECT FSZGCommandId,Command FROM FSZGCommands WHERE (FszgId=' + str(id) + ') ');
SQL.Add('AND (SentDate IS NULL) AND (ExecuteDate < ' + NowDBFunc + ') ORDER BY IssueDate ASC ;');
h:=3; t:=Now;
Open;
h:=4;
if IniParams.GPRS.CollectSQL then SqlHistory.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now) + #9 + Linearize(SQL.Text));
if IniParams.Log.GPRSSQL then FileLog(GPRSSQL,Linearize(SQL.Text));
if RecordCount > 0 then begin
First;
FSZGCommandId:=FindField('FSZGCommandId').AsInteger;
Send(FindField('Command').AsString);
h:=9;
UpdateFSZGEntry(FSZGCommandId,UpdStart,0,'Command was sent.');
end
else begin
h:=10;
Close;
SQL.Clear;
SQL.Add('SELECT UzenetId,Prioritas,Uzenet FROM Uzenetek WHERE (Fszg=' + str(id) + ') ');
SQL.Add('AND (UzenetTipusId=0) AND (Kezbesites IS NULL) AND (Kuldes < ' + NowDBFunc + ') AND (StatuszJelentes<>2) ');
SQL.Add('ORDER BY UzenetId DESC ;');
h:=11; t:=Now;
Open;
h:=12;
if IniParams.GPRS.CollectSQL then SqlHistory.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now) + #9 + Linearize(SQL.Text));
if IniParams.Log.GPRSSQL then FileLog(GPRSSQL,Linearize(SQL.Text));
h:=20;
if RecordCount > 0 then begin
First;
h:=30;
with IniParams.GPRS do case MessageFormat of
0 : begin
h:=40;
Send('MESS ' + FieldByName('Uzenet').AsString);
end;
1 : while not Eof do begin
UzenetId:=FieldByName('UzenetId').AsInteger;
h:=50;
Send('MESSAGE ' + str(UzenetId) + ' ' + FieldByName('Prioritas').AsString + ' ' + FieldByName('Uzenet').AsString);
Next;
end;
else FileLog(Errors,'Wrong value in IniParams.GPRS.MessageFormat : ' + str(MessageFormat));
end;
h:=60;
UpdateUzenetEntry(FieldByName('UzenetId').AsInteger,1);
end
else if IniParams.Local.FTPCommandSyntax = 0 then begin
h:=70;
Close;
SQL.Clear;
SQL.Add('SELECT Command,DIR_S,DIR_C,FileName,IssuerIP,FTPCommandId FROM FTPCommands WHERE (FszgId=' + str(id) + ') AND ((Command=1) OR (Command=2)) ');
SQL.Add('AND (ExecuteDate < ' + NowDBFunc + ') ');
SQL.Add('AND (DateDiff(day,ExecuteDate,' + NowDBFunc + ') <= ' + str(IniParams.GPRS.FTPCommandsExpiration) + ') ');
SQL.Add('AND ((StartDate IS NOT NULL) OR (FinishDate IS NULL)) ');
SQL.Add('AND ( (FinishDate IS NULL) '); // added 2010.04.02.
case IniParams.GPRS.FTPRetries of
OnNoInfo : SQL.Add('OR ((Status = 21) AND (Retries < ' + str(IniParams.GPRS.FTPRetryCount) + ')) ) ');
UntilSuccess : SQL.Add('OR ((Status NOT IN (20,22)) AND (Retries < ' + str(IniParams.GPRS.FTPRetryCount) + ')) ) ');
else SQL.Add(' ) ');
end;
SQL.Add('ORDER BY IssueDate ASC ;');
h:=71; t:=Now;
Open;
h:=72;
if IniParams.GPRS.CollectSQL then SqlHistory.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now) + #9 + Linearize(SQL.Text));
if IniParams.Log.GPRSSQL then FileLog(GPRSSQL,Linearize(SQL.Text));
if RecordCount > 0 then begin
First;
h:=73;
repeat
FTPMode:=ftpNoMode;
c:=FindField('Command').AsInteger;
case c of
1: FTPMode:=ftpPut;
2: FTPMode:=ftpGet;
else FileLog(Errors,'Unexpected command code in GPRSConn.FTPLoadCommands : ' + str(c));
end;
FTPAdd(FTPMode,FindField('DIR_S').AsString,
FindField('DIR_C').AsString,
FindField('FileName').AsString,
FindField('IssuerIP').AsString,
FindField('FTPCommandId').AsInteger);
Next;
until Eof;
h:=75;
end;
end
else if ExportId = 0 then begin
h:=80;
Close;
SQL.Clear;
SQL.Add('SELECT ExportId,FileName FROM NapiFeladatExportok WHERE (FSzg=' + str(id) + ') ');
SQL.Add('AND (Aktiv=1) AND (Statusz<>99) AND (CAST(Letrehozas AS Integer) = CAST(GETDATE() AS integer)) ');
SQL.Add('ORDER BY Sorrend ASC,Datum ASC');
h:=81; t:=Now;
Open;
h:=82;
if IniParams.GPRS.CollectSQL then SqlHistory.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now) + #9 + Linearize(SQL.Text));
if IniParams.Log.GPRSSQL then FileLog(GPRSSQL,SQL.Text);
h:=90;
if RecordCount > 0 then begin
First;
h:=100;
c:=FindField('ExportId').AsInteger;
Send('DOWNLOAD ' + str(c) + ' ' + FindField('FileName').AsString);
h:=110;
BusDataRequester:=nil;
ExportId:=c;
ExportTime:=Now;
h:=120;
Close;
SQL.Clear;
try
DatablocksCriticalSection.Enter;
DatablocksSQL.Add('UPDATE NapiFeladatExportok SET GpsComVette=GETDATE(),Statusz=9,Retries=Retries+1,Message=''' +
IniFile.ReadString('LocalReplyCodes','009','') + ''' WHERE ExportId=' + str(c));
finally
DatablocksCriticalSection.Leave;
end;
{ SQL.Add('UPDATE NapiFeladatExportok SET GpsComVette=GETDATE(),Statusz=9,Retries=Retries+1,Message=''' +
IniFile.ReadString('LocalReplyCodes','009','') + ''' WHERE ExportId=' + str(c));
h:=130;
ExecSQL;}
h:=140;
if IniParams.GPRS.CollectSQL then SqlHistory.Add(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Now) + #9 + Linearize(SQL.Text));
if IniParams.Log.GPRSSQL then FileLog(GPRSSQL,SQL.Text);
h:=150;
end;
end;
end;
h:=160;
finally
QueryText:=Query.SQL.Text;
//if IniParams.Log.Database then FileLog(DatabaseAll,QueryText);
Query.Free;
end;
except
on E: EDatabaseError do FileLog(DatabaseErrors,QueryText + E.Message);
on E: Exception do
if pos('General SQL Server error: Check messages from the SQL Server',E.Message)>0 then
FileLog(DatabaseErrors,QueryText + E.Message)
else FileLog(Exceptions,E.ClassName + ' in GPRSConn.FTPLoadCommands pos ' + str(h) +
FormatDateTime(', hh:nn:ss.zzz',Now-t) + ' after Open;' + EOL + E.Message);
end;
end;
Code: Select all
2011-08-15 15:05:01.375
EListError in GPRSConn.FTPLoadCommands pos 71, 00:00:00.016 after Open;
List index out of bounds (4)
2011-08-15 15:22:00.703
EInvalidPointer in GPRSConn.FTPLoadCommands pos 71, 00:00:00.015 after Open;
Invalid pointer operation
2011-08-15 19:57:11.781
EListError in GPRSConn.FTPLoadCommands pos 11, 00:00:00.000 after Open;
List index out of bounds (5)
2011-08-16 05:55:11.313
EInvalidPointer in GPRSConn.FTPLoadCommands pos 71, 00:00:00.016 after Open;
Invalid pointer operation
2011-08-16 09:27:11.156
EInvalidPointer in GPRSConn.FTPLoadCommands pos 11, 00:00:00.000 after Open;
Invalid pointer operation
2011-08-16 11:48:11.734
EInvalidPointer in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Invalid pointer operation
2011-08-16 11:48:11.953
EInvalidPointer in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Invalid pointer operation
2011-08-16 11:48:12.453
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 44626948
2011-08-16 11:48:12.688
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.016 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 546C714F
2011-08-16 11:48:12.953
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 546C714F
2011-08-16 11:48:13.188
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:13.406
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:13.641
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:13.875
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:14.109
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:48:14.328
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:48:14.531
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:14.750
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:14.984
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:15.188
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:15.422
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:15.656
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:15.891
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:48:16.094
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:48:16.297
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:16.531
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:16.766
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:16.984
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:17.203
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:17.438
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:17.672
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:48:17.891
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:48:18.125
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:18.359
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:48:18.594
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:48:18.828
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:49:11.156
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6620746B
2011-08-16 11:49:11.922
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 0C2B420D
2011-08-16 11:49:12.156
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7669724C
2011-08-16 11:49:12.391
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6E41656F
2011-08-16 11:49:12.625
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65537468
2011-08-16 11:49:12.859
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7267746F
2011-08-16 11:49:13.094
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 69646F69
2011-08-16 11:49:13.313
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 62726570
2011-08-16 11:49:13.547
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7267746F
2011-08-16 11:49:13.766
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53626948
2011-08-16 11:49:13.984
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65746948
2011-08-16 11:49:14.188
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6279535E
2011-08-16 11:49:14.438
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:49:14.672
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526568
2011-08-16 11:49:14.906
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 69772060
2011-08-16 11:49:15.125
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 654D6570
2011-08-16 11:49:15.344
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:49:15.578
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7267746F
2011-08-16 11:49:15.813
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65746170
2011-08-16 11:49:16.016
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6962656E
2011-08-16 11:49:16.250
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 74614470
2011-08-16 11:49:16.484
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 654D6568
2011-08-16 11:49:16.703
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 444F5270
2011-08-16 11:49:16.922
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 74614470
2011-08-16 11:49:17.156
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65746170
2011-08-16 11:49:17.391
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 654D6570
2011-08-16 11:49:17.625
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:49:17.859
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526568
2011-08-16 11:49:18.094
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 4D626948
2011-08-16 11:49:18.313
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7267746F
2011-08-16 11:49:18.531
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 5263696E
2011-08-16 11:49:18.750
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 54737461
2011-08-16 11:49:18.984
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65736E65
2011-08-16 11:49:19.188
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65537468
2011-08-16 11:49:19.406
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7361626E
2011-08-16 11:49:19.641
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65526461
2011-08-16 11:49:19.875
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7267746F
2011-08-16 11:49:20.109
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 72506E73
2011-08-16 11:49:20.344
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 61745368
2011-08-16 11:49:20.563
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 436C714F
2011-08-16 11:49:20.797
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7267746F
2011-08-16 11:49:21.031
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65537468
2011-08-16 11:49:21.250
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7361626E
2011-08-16 11:49:21.453
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53626948
2011-08-16 11:49:21.672
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53734D5E
2011-08-16 11:49:21.906
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 53657263
2011-08-16 11:49:22.141
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 61746E6B
2011-08-16 11:49:22.359
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 65746170
2011-08-16 11:49:22.594
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 61746E6B
2011-08-16 11:49:22.813
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 7361626E
2011-08-16 11:50:11.156
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:11.797
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:12.031
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:12.266
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:12.500
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:12.719
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:12.953
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:13.188
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:13.422
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:13.656
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:13.891
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
2011-08-16 11:50:14.125
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
...
from now on all addresses are the same several times each second, until 12:04:22
...
2011-08-16 12:04:22.641
EAccessViolation in GPRSConn.FTPLoadCommands pos 3, 00:00:00.000 after Open;
Access violation at address 00404650 in module 'GpsCom.exe'. Read of address 6C6C6163
Code: Select all
Call Stack Information:
------------------------------------------------------------------------------------------------------
|Address |Module |Unit |Class |Procedure/Method |Line |
------------------------------------------------------------------------------------------------------
|Running Thread: ID=308; Priority=0; Class=; [Main] |
|----------------------------------------------------------------------------------------------------|
|004ECDCA|GpsCom.exe|ZPlainDbLibDriver.pas |TZDBLibMSSQL7PlainDriver |CheckError |1209[22]|
|004FD0D7|GpsCom.exe|ZDbcDbLib.pas |TZDBLibConnection |CheckDBLibError |401[2] |
|004EFFD3|GpsCom.exe|ZDbcDbLibStatement.pas|TZDBLibStatement |FetchResults |296[24] |
|004F0173|GpsCom.exe|ZDbcDbLibStatement.pas|TZDBLibStatement |ExecuteQuery |329[5] |
|004DDD8D|GpsCom.exe|ZDbcStatement.pas |TZEmulatedPreparedStatement|ExecuteQuery |1984[1] |
|004DDEB1|GpsCom.exe|ZDbcStatement.pas |TZEmulatedPreparedStatement|ExecuteQueryPrepared|2025[1] |
|00596DCE|GpsCom.exe|ZAbstractRODataset.pas|TZAbstractRODataset |CreateResultSet |1591[25]|
|00596C20|GpsCom.exe|ZAbstractRODataset.pas|TZAbstractRODataset |CreateResultSet |1566[0] |
|00591480|GpsCom.exe|ZAbstractDataset.pas |TZAbstractDataset |CreateResultSet |328[1] |
|00596ECD|GpsCom.exe|ZAbstractRODataset.pas|TZAbstractRODataset |InternalOpen |1615[12]|
|0068D874|GpsCom.exe|GPRSUnit.pas |TGPRSConn |FTPLoadCommands |456[8] |
|0068D794|GpsCom.exe|GPRSUnit.pas |TGPRSConn |FTPLoadCommands |448[0] |
|0064F59C|GpsCom.exe|TimersUnit.pas |TTimers |FTPTimerTimer |477[3] |
|77F4E431|user32.dll| | |DispatchMessageA | |
|77F4E427|user32.dll| | |DispatchMessageA | |
|0069D8AA|GpsCom.exe|GPSCom.dpr | | |43[22] |
------------------------------------------------------------------------------------------------------
I suspect there are some global variables ZConnection or ZQuery uses that are not thread-safe. Or I lack some essential information that's Zeos specific and needed to run ZComponents multithreadedly safely.
I've already implemented TCriticalSection as I found it best.
These errors did not exist before I put Zeos in threads.
On the first sight I wonder the community's general suggestion about Zeos and threads, does anybody have experience pushing a DB server to its limits successfully this way ?
Thanks for any comments.
Cheers,
Peter
ps. I am on: Delphi 5; MSSQL 2005; Win2003 Server