You are not logged in.
Pages: 1
Hello,
it seems there is a Windows handle leak in mormot server. For every call to my service there are 5 handles added in my app (empty test service function).
So after running for some hours, or after heavy testing with SoapUI, there are access violations at unexpected places in my app.
I check the handle count with this function:
function GetProcessHandleCount(const hProcess: DWORD;
var pdwHandleCount: DWORD): BOOL; stdcall; external 'kernel32.dll';
Is this a known problem and how can I solve it? Could the build in caching the source of this problem?
I use rest server in sicSingle mode.
thanks for your reply,
Offline
Hello,
I am nearer to the source of this problem:
function TUploader.CheckIP: Boolean;
var
ip, ident: String;
con: TOleDBMSSQL2008ConnectionProperties;
function do_check(con: TOleDBMSSQL2008ConnectionProperties): Boolean;
var
ips: ISQLDBRows;
begin
Result := False;
if not assigned(con) then
Exit;
ips := con.Execute('SELECT identifier FROM AllowedSenders WHERE IP=?',[ip]);
while ips.Step do
begin
if VarToStrDef(ips['identifier'],'') = ident then
begin
Result := True;
Exit;
end;
end;
end;
begin
Result := False;
ip := FindIniNameValue(pointer(ServiceContext.Request.Call.InHead),'REMOTEIP: ');
if ip = '' then
Exit;
ident := GetURLParam('Identifier');
if ident = '' then
Exit;
con := dtmlConfig.CreateDBConnection;
try
Result := do_check(con);
finally
con.Free;
end;
end;
When I use this code, it leaves me with 3 windows Handles. Problem is in function do_check().
Last edited by jrvoorhorst (2014-07-22 15:00:02)
Offline
O, excuse me. I use the TOleDBMSSQL2008ConnectionProperties db connector.
It is created in the CreateDBConnection function.
Or is it better to have one global db connection and use it from all threads?
regards!
Last edited by jrvoorhorst (2014-07-23 06:17:38)
Offline
Hi ab,
please do you have any idea where I have to look for an solution? It seems te be something in the Connection.Execute functie.
Thanks!
Offline
One step further, I located the creation of the handles in function procedure SynOleDB.TOleDBConnection.Connect;
// open the connection to the DB
OleDBCheck(fDBInitialize.Initialize);
I assume the connection is not closed before destroying the connection. I will look further on it.
Offline
Pages: 1