Article View: borland.public.cppbuilder.internet.socket
Article #2684Re: [SOLVED] TCPServer Out of memory exception
From: Raffaele Pantaleoni
Date: Tue, 07 Feb 2006 08:12
Date: Tue, 07 Feb 2006 08:12
31 lines
2590 bytes
2590 bytes
Hi,
thak you for you answer.
Remy Lebeau (TeamB) ha scritto:
> Raffaele Pantaleoni <pantaraf@yahoo.it> wrote:
>
>> Msg=AThread->Connection->ReadLn("",5);
>
> You did not specify any terminator. Indy will use LF by default. If the client sends lots of data without sending LF then you could be filling up memory.
I was aware about this, but when the error comes out nothing is coming
from the client, the link is idle. Moreover if the link is populated by
data, no errors come out.
>> catch (Exception &exception)
>
> If an Indy exception occurs (one that is derived from EIdException), you should re-throw the exception so that the server knows that something went wrong with the connection. If you do not do that, or if you do not disconnect the connection manually, then the thread will never terminate properly.
Thank you for your complete answer. I intentionally cut out the rest of
my catch routine for easiness of reading, the rest of the catch routine
is about closing the connection and cleaning.
I think that I solved my problem, I raised the readln timeout up to 5000
and the server is running with an idle client connected for 15 hours
now. No "Out of memory" errors came out in the meantime. I will try also
a blocking readln, as you suggested.
I noticed that using a 1 ms timeout the "Out of memory" exception comes
out about every 5-8 minutes (using the very same conditions). While
using a 5 ms timeout it comes out in a range starting from 1 up to 3 hours.
Thank you.
Raffaele Pantaleoni
Technical Details
Message-ID:
<43e85590$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43e71eee$1@newsgroups.borland.com> <43e7d5c9$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,bcfef8d7a8434913 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 07 Feb 2006 09:12:20 +0100 From: Raffaele Pantaleoni <pantaraf@yahoo.it> User-Agent: Mozilla Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: [SOLVED] TCPServer Out of memory exception References: <43e71eee$1@newsgroups.borland.com> <43e7d5c9$1@newsgroups.borland.com> In-Reply-To: <43e7d5c9$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 81.208.18.193 Message-ID: <43e85590$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139299728 81.208.18.193 (7 Feb 2006 00:08:48 -0700) Lines: 31 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail