Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 98,307
» Latest member: ceolhluphitclub
» Forum threads: 2,426
» Forum posts: 11,371

Full Statistics

Online Users
There are currently 2442 online users.
» 2 Member(s) | 2436 Guest(s)
Applebot, Bing, Google, Internet Archive, ceolhluphitclub, zowin9net

Latest Threads
WebApplication.IP change ...
Forum: IntraWeb General Discussion
Last Post: MJS@mjs.us
09-11-2026, 09:49 PM
» Replies: 1
» Views: 210
Hook/callback to handle t...
Forum: IntraWeb General Discussion
Last Post: Lenfors
09-08-2026, 09:03 AM
» Replies: 0
» Views: 165
Reproducible IIS crash in...
Forum: IntraWeb General Discussion
Last Post: alex.trejo@tttnet.com.mx
09-08-2026, 01:48 AM
» Replies: 0
» Views: 179
The packages IW16.xx inc...
Forum: IntraWeb General Discussion
Last Post: hsbelli
09-03-2026, 11:46 AM
» Replies: 2
» Views: 487
Redirection issues with F...
Forum: IntraWeb General Discussion
Last Post: magosk
08-31-2026, 10:03 AM
» Replies: 0
» Views: 251
Source Code
Forum: IntraWeb General Discussion
Last Post: magosk
08-31-2026, 08:11 AM
» Replies: 3
» Views: 654
TContenthandler requires ...
Forum: IntraWeb General Discussion
Last Post: valmeras
08-30-2026, 02:35 AM
» Replies: 0
» Views: 230
TIWjQDBGrid erratic behav...
Forum: IntraWeb General Discussion
Last Post: alex.trejo@tttnet.com.mx
08-20-2026, 05:12 PM
» Replies: 8
» Views: 2,258
Change Language DataTable
Forum: IntraWeb General Discussion
Last Post: Rigoberto Mercedes
08-19-2026, 03:21 PM
» Replies: 1
» Views: 368
How to terminate HTTP Thr...
Forum: Indy
Last Post: rlebeau
08-14-2026, 08:01 AM
» Replies: 5
» Views: 994

 
  TidHTTPServer and Orphaned Connection Threads
Posted by: takyon_dg - 06-27-2019, 08:02 PM - Forum: Indy - Replies (8)

So I've got an HTTP Service and after about 25,000-35,000 connections in a live environment, I start to get "EOutofMemory" errors and eventually the OnListenException event starts getting triggered with "Thread creation error: Not enough storage is available to process this command". 

Eventually the service just can't accept any new connections and we get other evidence if resource limitation issues in the main service thread and anything that attempts to write to the disk. 

Now there are plenty of EIdOSSLAcceptError and EIdSocketError (usually 10054, 10053 or 10060) triggered in the generic HTTP Exception handler. I've recently updated from 1.0.1t to 1.0.2s on the openssl side to see if it mitigates some of these ssl protocol errors. Anyhow, trapped inside my OnCommandGet Handler, the most common exception (Socket Error #10054. Connection reset by peer.) is around a GET request that serves up an image via SmartServeFile. But it's not specific to any one image and it's intermittent and not something I've been able to trigger in the development environment, we figure the client just drops connection before SmartServe can complete and this is what it looks like when it happens. Most of the 'heavy lifting' for the service happens in a POST process.

Now I've tried creating some exceptions in my OnCommandGet handler (sending bad data) to see if I'm cleaning up in my try/finally and exceptions and it all looks good. Eurekalog doesn't report any leaked memory and my thread count stays stable. 

In the live environment, I see the service is steadily growing in thread count. Seems to die somewhere around 1500 threads after about 6-10hrs depending on traffic, however plenty of hardware resources left (RAM and SSD). A simple restart of the service works just fine. So this implies there's a bunch of orphaned threads. Looking at process monitor, I can see hundreds of threads what would likely have started as CommandGet connection threads, still existing from HOURS ago. CPU utilization is very low, and the application handling these thousands of connections doesn't use up much cycles... so it doesn't appear these threads are stuck in any kind of loop. The Stack for all of these 'old' threads just shows:

ntoskrnl.exe!KeSynchronizeExecution+0x5bd6
ntoskrnl.exe!KeWaitForMultipleObjects+0x109d
ntoskrnl.exe!KeWaitForMultipleObjects+0xb3f
ntoskrnl.exe!KeWaitForMutexObject+0x377
ntoskrnl.exe!KeQuerySystemTimePrecise+0x881
ntoskrnl.exe!ObDereferenceObjectDeferDelete+0x28a
ntoskrnl.exe!KeWaitForMultipleObjects+0x1284
ntoskrnl.exe!KeWaitForMultipleObjects+0xb3f
ntoskrnl.exe!KeWaitForMutexObject+0x377
ntoskrnl.exe!NtWaitForSingleObject+0xf8
ntoskrnl.exe!_setjmpex+0x68a3
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x540
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x3a5
wow64.dll!Wow64KiUserCallbackDispatcher+0x4151
wow64.dll!Wow64LdrpInitialize+0x120
ntdll.dll!LdrInitializeThunk+0x16d
ntdll.dll!LdrInitializeThunk+0xe

None of which is my windows service (obviously), but it suggests the thread(s) are still alive.

I'm wondering how I can dig deeper into these seemingly orphaned threads to figure out how they got orphaned. Even with the EIdOSSLAcceptError and EIdSocketError's the number of those that occur, do not accumulate to the number of threads. And yes, I'm re-raising EIdExceptions in my handlers. 

Any ideas would be appreciated. 

Indy version is 10.6.1.5182 on XE7. 

Basic service structure is in the OnCommandGet is...

Code:
procedure TsvcThing.srvHTTPCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
  XMLDoc: IXMLDocument;
  adoConn: TADOConnection;
  adoQuery, adoQueryOther: TADOQuery;
begin
  try
    CoInitialize(nil);
    try
      if ARequestInfo.Command = 'GET' then
        //serve up the requested file
        AResponseInfo.SmartServeFile(AContext, ARequestInfo, Path + filename);

      if ARequestInfo.Command = 'POST' then
      begin
        adoConn := TADOConnection.Create(nil);
        adoQuery := TADOQuery.Create(nil);
        adoQueryOther := TADOQuery.Create(nil);

        try
          adoConn.ConnectionString := 'valid connection string';
          adoQuery.Connection := adoConn;
          adoQueryOther.Connection := adoConn;

          if not adoConn.Connected then
            adoConn.Connected := true;

          XMLDoc := LoadXMLData(ReadStringFromStream(ARequestInfo.PostStream, -1));
          try
            //perform various queries (Open and ExecSQL) based on XML request

            //set fields in XML response

            if error_processing_xml_or_data then
              AResponseInfo.ResponseNo := 400
            else
            begin
              AResponseInfo.ContentType := 'application/xml';
              AResponseInfo.ResponseNo := 200;
              AResposneInfo.ContentText := XMLDoc.XML.Text;
            end;
          finally
            XMLDoc.Active := False;
          end;
        finally
          FreeAndNil(adoQueryOther);
          FreeAndNil(adoQuery);
          FreeAndNil(adoConn);
        end;    
      end;
    finally
      CoUnintialize;
    end;
   except
     on E: Exception do
       if Log then
          WriteLog(E.Message);
     on EIdException do raise;
   end;
end;

Print this item

  Indy SSL
Posted by: MusicBuddha - 06-27-2019, 03:46 AM - Forum: Indy - Replies (4)

Ti there,

I am just wondering if Indy Supports SSL? If so could someone possible post an example in C++?

Thanks,

MusicBuddha

Print this item

  TIdConnectionIntercept TCP Header Encrypting
Posted by: whitekn3 - 06-24-2019, 11:01 PM - Forum: Indy - Replies (2)

I am working on a C++ project that was using Indy 9 and now uses Indy 10 to talk to device controllers that use a proprietary encryption method. 

In Indy 9 a TMemoryStream object was used that included the TCP Packet header and we could read and set the TCP headers bytes directly.   Indy 10 uses a TIdBytes instead of TMemoryStream and I cannot figure out any way to manipulate the TCP Packet header bytes to get the same results.

Is there a component I should be looking at?  Documentation or a post somewhere that might help me?

Print this item

  custom html page if file not found
Posted by: MrSpock - 06-22-2019, 06:52 AM - Forum: IntraWeb General Discussion - Replies (8)

intraweb 14

If a user tries to open file my-domain/file.htm they get the standard intraweb message 404. I have had no luck changing it with my custom html page.

Print this item

  push data to browser
Posted by: MrSpock - 06-22-2019, 06:46 AM - Forum: IntraWeb General Discussion - Replies (7)

intraweb 14

I have used a method to check server state with onAsyncTimer installed on browsers. Every second browser timer fires a question to the server. This takes too much traffic for 100 browser connected. How to implement that to push data to browser when for example server side timer detects a change and needs to notify browser to refresh its page.

Print this item

  Form height and HTML
Posted by: OronzoConte - 06-20-2019, 04:27 PM - Forum: IntraWeb General Discussion - Replies (5)

Hallo,
I have problems in converting HTML to PDF. The reason, I think, is that the height of the form (delphi) differs from HTML height. Infact Delphi sees wrapped labels as 1 line. 
Normally I set Form Height as the top of the last line but it seems not to be possible with wrapped labels. 
I tried calculating the height of wrapped labels in JavaScript and posted the value in a label of the screen. I see the value but when I read  that value (on click) it returns empty. 
Any suggestion?
Is there another way to resize the form with the correct height?
Best regards

Print this item

  Template not visible TIWWebOSMaps
Posted by: matija - 06-19-2019, 10:24 AM - Forum: IntraWeb General Discussion - Replies (6)

In my template not visible TIWWebOSMaps

<div class="container-fluid"> 
    <div class="row">
         <div class="col">  
              {%OSMap%}
        </div>
    </div>
</div>

Config MapOptions is Ok.
RenderStatus, RenderVisible, RenderZIndex = true ... other false;

Print this item

  Async events dont trigger after IW 15.0.22/23 update
Posted by: msgopala - 06-18-2019, 12:02 PM - Forum: IntraWeb General Discussion - Replies (19)

After updating to  IW 15.0.22 the Async events have stopped working for TMS controls. Updated to 15.0.23 but the problem exists.

Print this item

  IW 15.0.23 is out
Posted by: Alexandre Machado - 06-15-2019, 01:00 AM - Forum: IntraWeb General Discussion - Replies (4)

Hi,

there is a new update available, version 15.0.23. It contains a fix for a recently introduced bug regarding IWForm's OnAsyncResize/OnResize events.

https://www.atozed.com/2019/06/intraweb-15-0-23/

Cheers

Print this item

  OnClick not Submitted
Posted by: mludwig@adc-elektronik.de - 06-13-2019, 03:22 PM - Forum: IntraWeb General Discussion - Replies (5)

Hi ,

i´ve  found a strange effect after switching my Intraweb program from Delphi Tokyo Intraweb 14 to Delphi RIO Intraweb 15.0.22.

When the first IWForm (a login dialog) opens in browser none of the onclick events work.

Javascripterror :

IWBase__ED495B2B5.js:2 Error in IW.Session.execSyncResize(): urlAddSessionParams is not defined
consoleError @ IWBase__ED495B2B5.js:2
execSyncResize @ IWBase__ED495B2B5.js:4
(anonymous) @ IWBase__ED495B2B5.js:4
setTimeout (async)
doSyncResize @ IWBase__ED495B2B5.js:4
IWCL_TriggerResize @ IWBase__ED495B2B5.js:5
DoSecondResize @ IWGecko__ED495B2B5.js:1
(anonymous) @ IWBase__ED495B2B5.js:4

If i press F12 in Firefox and connect to my server again Onclick is submitted one time .

Sometimes (after  10-20 tries restarting server) Onclick works normaly. I was able to login and after than
all onclicks on all other forms works correct until i log off.  

i´ve made a simple form with only some buttons and edits and use this as mainform. Onclick in this from works.




Any idea ?

Print this item