Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Leak in HTTPRio? in TOMCAT? No more Internet handles can be allocated

102 views
Skip to first unread message

m.durl...@bo.nettuno.it

unread,
Oct 5, 2007, 9:43:20 AM10/5/07
to
Hello,
sorry for crossposting but I think it involves all the 3 groups.
I have a server application that communicate with many clients via
TCP/IP sockets.

void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
each TCPServer1Execute thread launched by a request from a client
generates a call to an external webservice with this procedure:

THTTPRIO* iRio = new THTTPRIO(this);
iRio->URL = "urlname";
_di_Server iService;
iRio->QueryInterface(iService);

Response=iService->serviceName(XMLDocument->XML->Text);
iService = NULL;

It works perfectly for days, then suddendly it crashes every
webservice call with a:
"No more Internet handles can be allocated - URL:urlname -
SOAPAction:"""

where urlname is the same valid URL I use in the program.
The web service server is TOMCAT, and the same happens on different
servers where the two applications are installed.

Do you have any idea of why this is happening?

Thanks!
Matt


Remy Lebeau (TeamB)

unread,
Oct 5, 2007, 12:54:33 PM10/5/07
to

<m.durl...@bo.nettuno.it> wrote in message
news:c1fcg3tprri33t0o5...@4ax.com...

> THTTPRIO* iRio = new THTTPRIO(this);

Are you ever deleting that object after sending a request?

Assuming 'this' is the pointer to your TForm1 instance, I do not suggest
using the TForm as the Owner for the object. TIdTCPServer is a
multi-threaded component, and the TForm's Components array is not
thread-safe. Use a NULL Owner and 'delete' the object when you are done
with it, ie:

THTTPRIO* iRio = new THTTPRIO(NULL);
//...
delete iRio;


Gambit


m.durl...@bo.nettuno.it

unread,
Oct 8, 2007, 4:53:31 AM10/8/07
to
Hello,

if I delete the iRio, I receive an AccessViolation error.
I changed the 'this' to 'NULL' anyway, but I still don't know if
that's was the problem because it normally occurs after some days.

THTTPRIO* iRio = new THTTPRIO(NULL);
//...
delete iRio;

Do you have any idea why I receive this AccessViolation?

Thanks,
Mattia

Jean-Marie Babet

unread,
Oct 11, 2007, 7:20:10 PM10/11/07
to
Hello Mattia,

> if I delete the iRio, I receive an AccessViolation error.

The most common reason why deleting a RIO causes an AV is if it was created
with (NULL). When you create a RIO object with NULL, its lifetime will be
managed via the refcount of the interface it hands out. So you do *NOT* want
to call delete on the object explicitly. You simply want to release the
interface it handed out.

To illustrate:

THTTPRIO* iRIO = new THTTPRIO(NULL);

__di_someInterface service;
iRIO->QueryInterface(service);

service.Release(); // < (**)


The call to 'service.Release()' will cleanup the iRIO instance (provided no
one else is holding on to references to 'service').

Let me know if the above does not help!

Cheers,

Bruneau.


m.durl...@bo.nettuno.it

unread,
Oct 15, 2007, 11:18:35 AM10/15/07
to
Hello Jean Marie,

> service.Release(); // < (**)

previous than deleting iRio, and following some other samples, I used:
service = NULL;
that doesn't give the AV and works, but as reported earlier, after
some time (can be just some days or weeks) suddendly it crashes every


webservice call with a:
"No more Internet handles can be allocated - URL:urlname -
SOAPAction:"""

I'll change service=NULL to service.Release(); as per you
reccomendation, but do you think it will behave differently in the
long time? (I mean: do you think that using the NULL assignment was
wrong and was the cause of the "No more internet handles...")

Thank you very much!
Mattia

Jean-Marie Babet

unread,
Oct 15, 2007, 3:01:09 PM10/15/07
to
Hello,

Invoking Release() or assigning NULL to a DelphiInterface<T> should have the
same effect: i.e. invoke 'Release' on the underlying interface.

What version of Delphi do you have? I don't recall any particular issue in
that area but it's possible that maybe the version of the runtime you're
using had a leak of interface handles.

Cheers,

Bruneau.


m.durl...@bo.nettuno.it

unread,
Oct 15, 2007, 6:31:24 PM10/15/07
to
Hello,

not Delphi, I'm using CBuilder 6.
Actually, looking for "httprio leak" in google I found some references
to a similar problem (many users are experiencing a memory leak using
the component) but I couldn't find a way to solve it.
And I don't know if I'm having the same problem (I notice the memory
leak using the memproof program), but I don't know if the same memory
leak is responsible of the strange error message I receive:


"No more Internet handles can be allocated - URL:urlname -
SOAPAction:"""

Thanks,
Mattia

Jean-Marie Babet

unread,
Oct 16, 2007, 1:00:35 PM10/16/07
to
Hello,

> not Delphi, I'm using CBuilder 6.

OK! Yes, if it's CBuilder6 you're probably running into a runtime bug that
has been addressed. Unfortunately, it's not that easy to merge the current
runtime to the v6.0 version. Let me see if I can find any change that would
be relevant to this issue. If time allows, can you email me a copy of the
SOAPHTTPTrans.pas file from your copy of CBuilder6.

Cheers,

Bruneau.


m.durl...@bo.nettuno.it

unread,
Oct 17, 2007, 5:42:10 AM10/17/07
to
>
>OK! Yes, if it's CBuilder6 you're probably running into a runtime bug that

Oh great, I just sent the files to your email.
Thank you very much for your help.
Mattia

0 new messages