Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TidHTTPServer and Orphaned Connection Threads
#2
(06-27-2019, 08:02 PM)takyon_dg Wrote: Indy version is 10.6.1.5182 on XE7. 

That is a VERY old version of Indy.  The current version is 10.6.2.5503.  I strongly suggest you upgrade and see if the problem still continues.

(06-27-2019, 08:02 PM)takyon_dg Wrote: Basic service structure is in the OnCommandGet is...

I notice is there are no local variables being declared.  Are your ADO and XML variables really being shared across multiple firings of the OnCommandGet event?  That is not good, if you have multiple clients connected to your server at the same time.  The ADO and XML objects need to be local to each request, or cached in the TIdContext object so they can be reused in multiple requests from the same client.

Also, you are not releasing the XML object from memory before calling CoUninitialize(), so it will get released after COM has already been ripped away from behind its proverbial back.  You MUST release/nil COM interfaces before uninitializing COM.

For that matter, I would not suggest calling Co(Un)Initialize() inside of your OnCommandGet handler at all.  A better solution is to
  • create a new class derived from TIdThreadWithTask and override its virtual BeforeExecute() and AfterExecute() methods to call Co(Un)Initialize().
  • create an explicit TIdSchedulerOfThreadDefault or TIdSchedulerOfThreadPool object and assign your thread class to its ThreadClass property.
  • assign that Scheduler object to the TIdHTTPServer.Scheduler property before activating the server.

Reply


Messages In This Thread
RE: TidHTTPServer and Orphaned Connection Threads - by rlebeau - 06-28-2019, 06:24 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)