You are not logged in.
Pages: 1
I have noticed some problems with TSQLDBServerHttpApi when using a thread pool with TOleDBMSSQL2012ConnectionProperties. The Ole CoUninit assertion seems to fail at times.
The Server runs in a Windows Service:
FProps := TOleDBMSSQL2012ConnectionProperties.Create('127.0.0.1\SQLEXPRESS','test','test','test');
FHttpServer := TSQLDBServerHttpApi.Create(FProps,'test',80,'test','test',False,64,nil,tmThreadPool);
The Client connection is created in a datamodule constructor and freed in the destructor:
http := TSQLDBWinHTTPConnectionProperties.Create(...)
statement := http.NewThreadSafeStatementPrepared(SomeSQL,True,True);
....parameter binding....
statement.ExecutePrepared;
Seeing this in the log at times:
20220715 06004760 ' ERROR "EAssertionFailed(125fef00)":"You should call TOleDBConnection.Free from the same thread which called its Create: i.e. call MyProps.EndCurrentThread from an THttpServerGeneric.OnHttpThreadTerminate event - see ticket 213544b2f5
Memory allocation seems to keep increasing over time because of this. . I tried using a HttpThreadTerminate event calling TSQLDBConnectionPropertiesThreadSafe(FProperties).EndCurrentThread, but the problem persists; Please help.
Offline
Made your descendant of TSQLDBServerHttpApi to access protected FServer: THttpServerGeneric TSqlDBServerAbstract member.
Add FServer.OnHttpThreadTerminate handler, and inside added handles call Properties.EndCurrentThread
Pseudo-code:
FHttpServer.FServer.OnHttpThreadTerminate = function() begin Properties.EndCurrentThread; end;
As alternative - use an ODBC connection instead of OleDB
Last edited by mpv (2022-07-20 06:52:21)
Offline
FHttpServer.FServer.OnHttpThreadTerminate = function() begin Properties.EndCurrentThread; end;
Damn! After reading your post I was hoping that the newest delphi allows to implement anonymous event handlers, so I immediately tried it in my Alexandria Seems that we still have to wait for that extra feature.
Offline
Made your descendant of TSQLDBServerHttpApi to access protected FServer: THttpServerGeneric TSqlDBServerAbstract member.
Add FServer.OnHttpThreadTerminate handler, and inside added handles call Properties.EndCurrentThread
Pseudo-code:FHttpServer.FServer.OnHttpThreadTerminate = function() begin Properties.EndCurrentThread; end;
As alternative - use an ODBC connection instead of OleDB
Thank you. I will try that.
Offline
Pages: 1