Subject | Still threading problems |
---|---|
Author | Christian Kaufmann |
Post date | 2005-05-12T10:07:11Z |
Hi,
I still have problems with threads. I built a service application with
Indy TIdHttpServer. It works fine, if there are only some requests or
if I run it on my laptop.
But if I put it on our server (with Hyper Threading) and I simulate
some load with Ctrl-R in the browser, at some the application is just
killed, sometimes with exceptions (always in unit SqlExpr), most of
the time with no feedback.
I reduced the code in the request to a minimum and I don't see, what
goes wrong:
procedure TWebGetTestDB.TestWithDbx;
var
conn : TSQLConnection;
qry : TSQLDataSet;
s : String;
begin
conn := TSQLConnection.Create(nil);
conn.LoginPrompt := False;
conn.SQLHourGlass := False;
conn.LoadParamsOnConnect := False;
conn.ConnectionName := 'DATABASE';
conn.DriverName := 'DBX_DRIVER';
conn.LoginPrompt := False;
conn.Params.Values['Database'] := 'localhost:\D:\mydb.fdb';
conn.Params.Values['User_Name'] := 'SYSDBA';
conn.Params.Values['Password'] := 'masterkey';
conn.GetDriverFunc := 'getSQLDriverFB';
conn.LibraryName := 'dbxup_fb.dll';
conn.VendorLib := 'fbclient.dll';
conn.Params.Values['DBX TransIsolation'] := 'ReadCommited';
conn.Params.Values['ServerCharSet'] := 'ISO8859_1';
conn.Open;
qry := TSQLDataSet.Create(nil);
qry.SQLConnection := conn;
qry.CommandText := 'select * from STYLE';
qry.Prepared := True;
qry.NoMetaData := True;
qry.Open;
qry.First;
s := 'Data: ';
while not qry.Eof do begin
s := Format('%s - %d', [s, qry.FieldByName('STYLEID').AsInteger]);
qry.Next;
end; // while
FResponse.ContentType := 'text/html';
FResponse.ContentText := s;
qry.Free;
conn.Free;
end;
Did I miss something here? If the application can catch an error, it's
in the open method of the connection or in the open method of the
dataset. But it happens random. And if I Synchronize the test method,
there is never a problem.
cu Christian
I still have problems with threads. I built a service application with
Indy TIdHttpServer. It works fine, if there are only some requests or
if I run it on my laptop.
But if I put it on our server (with Hyper Threading) and I simulate
some load with Ctrl-R in the browser, at some the application is just
killed, sometimes with exceptions (always in unit SqlExpr), most of
the time with no feedback.
I reduced the code in the request to a minimum and I don't see, what
goes wrong:
procedure TWebGetTestDB.TestWithDbx;
var
conn : TSQLConnection;
qry : TSQLDataSet;
s : String;
begin
conn := TSQLConnection.Create(nil);
conn.LoginPrompt := False;
conn.SQLHourGlass := False;
conn.LoadParamsOnConnect := False;
conn.ConnectionName := 'DATABASE';
conn.DriverName := 'DBX_DRIVER';
conn.LoginPrompt := False;
conn.Params.Values['Database'] := 'localhost:\D:\mydb.fdb';
conn.Params.Values['User_Name'] := 'SYSDBA';
conn.Params.Values['Password'] := 'masterkey';
conn.GetDriverFunc := 'getSQLDriverFB';
conn.LibraryName := 'dbxup_fb.dll';
conn.VendorLib := 'fbclient.dll';
conn.Params.Values['DBX TransIsolation'] := 'ReadCommited';
conn.Params.Values['ServerCharSet'] := 'ISO8859_1';
conn.Open;
qry := TSQLDataSet.Create(nil);
qry.SQLConnection := conn;
qry.CommandText := 'select * from STYLE';
qry.Prepared := True;
qry.NoMetaData := True;
qry.Open;
qry.First;
s := 'Data: ';
while not qry.Eof do begin
s := Format('%s - %d', [s, qry.FieldByName('STYLEID').AsInteger]);
qry.Next;
end; // while
FResponse.ContentType := 'text/html';
FResponse.ContentText := s;
qry.Free;
conn.Free;
end;
Did I miss something here? If the application can catch an error, it's
in the open method of the connection or in the open method of the
dataset. But it happens random. And if I Synchronize the test method,
there is never a problem.
cu Christian