
I have a customized IdHTTPWebBrokerBridge class which descends from TIdCustomHTTPServer and overrides the DoCommandGet method. Below is the basic code
I noticed that the thread count of the process keeps slowly increasing and even reached around above 1500 threads in a few days. It keeps on increasing until I am getting an "Access violation at address 00401ED5 in module 'xxx.exe'. Read of address 80030000" error. I am not sure why it keeps increasing over time. What might cause the threads to stay and not get released? I did set KeepAlive to true to save on the SSL handshake costs.
I have tried logging all requests and responses and do not see any error that might cause this. I also did not find any long running processes that are stuck in an infinite loop. The thread count does not justify the activity going on. Even when there is no more activity, the thread count does not decrease. I'm already using the latest Indy v10.6.3.3 and OpenSSL v1.0.2u DLL files.
Code:
procedure TIdHTTPWebBrokerBridge.DoCommandGet(AThread: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
LRequest: TIdHTTPAppRequest;
LResponse: TIdHTTPAppResponse;
begin
LRequest := TIdHTTPAppRequest.Create(AThread, ARequestInfo, AResponseInfo);
try
LResponse := TIdHTTPAppResponse.Create(AThread, LRequest, ARequestInfo, AResponseInfo);
try
// WebBroker will free it and we cannot change this behaviour
AResponseInfo.FreeContentStream := False;
try
if TWebDispatcherAccess(FWebModule).DispatchAction(LRequest, LResponse) then
begin
if not LResponse.Sent then
begin
LResponse.SendResponse;
end;
end;
finally FreeAndNil(LResponse); end;
finally FreeAndNil(LRequest); end;
end;
I noticed that the thread count of the process keeps slowly increasing and even reached around above 1500 threads in a few days. It keeps on increasing until I am getting an "Access violation at address 00401ED5 in module 'xxx.exe'. Read of address 80030000" error. I am not sure why it keeps increasing over time. What might cause the threads to stay and not get released? I did set KeepAlive to true to save on the SSL handshake costs.
I have tried logging all requests and responses and do not see any error that might cause this. I also did not find any long running processes that are stuck in an infinite loop. The thread count does not justify the activity going on. Even when there is no more activity, the thread count does not decrease. I'm already using the latest Indy v10.6.3.3 and OpenSSL v1.0.2u DLL files.