07-04-2019, 03:41 PM
(07-04-2019, 12:22 AM)rlebeau Wrote:You're right (I thought it might create a leak).(07-03-2019, 01:54 PM)takyon_dg Wrote: I'm also setting the XMLDoc to nil after Active := False, which I now imagine will address the leak/'orphaned' threads.
That had nothing to do with your orphaned thread issue. It was simply a bug in your code related to how you manage COM objects.
New Indy is in there (6.2.5499), and that line. Same problem persists.
Any suggestions?
What I was thinking was I would track threadId's, their HTTP request and then in some other event handler, remove them from the list if they are properly closed and log the orphaned ones on a timer... I guess what I'm asking is, in terms of the TidHTTPServer events, is there (and which) one that gets triggered after the OnCommandGet (connection thread) is properly terminated/exited? I see OnContextCreated, but not sure which one might happen after. or would I have to gain access to the TidSchedulerOfThreadDefault and assign a method to the AfterExecute event?
Also, is there a straight-forward way to pull the HTTP header User-Agent from TidContext in OnException? I'm trying to isolate if a lot of my socket errors (including SSL handshake issues) are specific to an client OS or http control version. All the exceptions I have here seem to occur before OnCommandGet which I imagine means the datastream has not been identified/parsed as HTTP. My past attempts showed nothing in the input buffer to record and I wasn't sure what would happen if I try to use any of the read functions (AContext.Connection.Socket....)