 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Laura Hilby Guest
|
Posted: Mon Feb 23, 2004 7:22 pm Post subject: TIDTCPServer doesn't accept any connections at some point |
|
|
Hi!
I'm using D5 and Indy 9. I have a server app using TIDTCPServer,
maxConnections set to 0 and LinstenQueue set to default (15). The client app
connects and sends a request, once it receives the answer back it
disconnects.The server is accepting connections for days and all works fine
until some point when stops accepting any connections and the client app
gets 100061 connection refused error. The server application is not frozen,
all seem to be fine just the server is not accepting connections. If I shut
down and restart the app the server is working normally again.
Any idea what is going on with my server? What should I do?
Thanks,
Laura Hilby
EIMS Inc.
|
|
| Back to top |
|
 |
Laura Hilby Guest
|
Posted: Mon Feb 23, 2004 9:13 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
I added some writing to a log in OnListenException and I'm waiting to see if
I get any exceptions.
My app uses ExceptionMagic that is supposed to capture exceptions and
nothing was captured.
I'll have to wait and see.
Laura
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote
| Quote: |
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote in message
news:403a5198$1 (AT) newsgroups (DOT) borland.com...
The server is accepting connections for days and all works fine
until some point when stops accepting any connections and the
client app gets 100061 connection refused error. The server
application is not frozen, all seem to be fine just the server is not
accepting connections.
TIdTCPServer uses a separate thread for accepting new connections. The
only
way what you describe can happen is if the listening thread has been
aborted
such that accept() is no longer being called.
Have you checked to see whether the OnListenException event is being
triggered at all?
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Feb 23, 2004 9:50 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote
| Quote: | I added some writing to a log in OnListenException and I'm waiting
to see if I get any exceptions. My app uses ExceptionMagic that is
supposed to capture exceptions and nothing was captured.
|
Then the only other possibilities are that either 1) the listening thread
aborted silently without an exception actually being thrown, or 2) the
listening thread is somehow deadlocked.
Gambit
|
|
| Back to top |
|
 |
Laura Hilby Guest
|
Posted: Mon Feb 23, 2004 9:57 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
1.If it is aborting silently, what can I do about it?
2.If is deadlocked can I take it out of this status? How?
Laura
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> wrote
| Quote: |
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote in message
news:403a6b92 (AT) newsgroups (DOT) borland.com...
I added some writing to a log in OnListenException and I'm waiting
to see if I get any exceptions. My app uses ExceptionMagic that is
supposed to capture exceptions and nothing was captured.
Then the only other possibilities are that either 1) the listening thread
aborted silently without an exception actually being thrown, or 2) the
listening thread is somehow deadlocked.
Gambit
|
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Mon Feb 23, 2004 10:04 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote in
news:403a75fe (AT) newsgroups (DOT) borland.com:
| Quote: | 1.If it is aborting silently, what can I do about it?
|
Find your error and fix it.
| Quote: | 2.If is deadlocked can I take it out of this status? How?
|
Dont deadlock it in the first place.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Feb 23, 2004 11:40 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote
| Quote: | 1.If it is aborting silently, what can I do about it?
|
Nothing. You would have to restart the server. The listening thread(s) are
only started when the server's Active property is set to true when the
server is previously inactive.
| Quote: | 2.If is deadlocked can I take it out of this status?
|
No, a deadlock is a permanent condition. Off-hand, though, I don't know of
any conditions that would deadlock the listening thread.
Gambit
|
|
| Back to top |
|
 |
Laura Hilby Guest
|
Posted: Tue Feb 24, 2004 12:10 am Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
I was asking for help not a slap on the face.There are quite a bit of people
complaining about your answers in the newsgroup.
My server app was build on your server demo so if my listener thread becomes
deadlock that means your demo will produce the same thing.
"Chad Z. Hower aka Kudzu" <cpub (AT) hower (DOT) org> wrote
| Quote: | "Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote in
news:403a75fe (AT) newsgroups (DOT) borland.com:
1.If it is aborting silently, what can I do about it?
Find your error and fix it.
2.If is deadlocked can I take it out of this status? How?
Dont deadlock it in the first place.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 24, 2004 12:37 am Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote
| Quote: | My server app was build on your server demo so if my listener
thread becomes deadlock that means your demo will produce
the same thing.
|
A deadlock is only one possibility. More likely, the listener thread simply
detected a WinSock error and terminated itself silently.
Gambit
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Tue Feb 24, 2004 7:29 am Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote in
news:403a9509 (AT) newsgroups (DOT) borland.com:
| Quote: | I was asking for help not a slap on the face.There are quite a bit of
|
It wasnt a slap in the face - I told you steps to resolve it. Im not here to
write code for you.
| Quote: | people complaining about your answers in the newsgroup.
|
Then fine - I'll simply add you to my kill file. Im not obligated to answer
your questions or anyone elses.
| Quote: | My server app was build on your server demo so if my listener thread
becomes deadlock that means your demo will produce the same thing.
|
Its not my demo.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Need extra help with an Indy problem?
http://www.atozed.com/indy/experts/
|
|
| Back to top |
|
 |
Eric Jansen Guest
|
Posted: Tue Feb 24, 2004 10:39 am Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> schreef in bericht
news:403a75fe (AT) newsgroups (DOT) borland.com...
| Quote: | 1.If it is aborting silently, what can I do about it?
2.If is deadlocked can I take it out of this status? How?
|
Unfortunately I have no Indy experience (I use D5 & ICS, and I am thankful
if I see what kind of help Mr Kudzu is giving here), but I can tell you
this:
If the listening thread is aborted silently (I don't know what Remy means by
this exactly; maybe an Abort exception or a stack overflow) or if the thread
is deadlocked, the thread will not running its main loop anymore. The
listening thread is probably running in a message loop, and in this loop you
could increment a counter to see if the thread is still running. This is a
method I sometimes use. If the message loop is still active, you know at
least that there is no deadlock and no exception. If the loop is no longer
active, the only thing I can suggest is add logging code (on entry&exit of
key procedures) to find out where things go wrong.
hth,
Eric Jansen
|
|
| Back to top |
|
 |
Dean Guest
|
Posted: Tue Feb 24, 2004 11:08 am Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
Some good advice in Erics post, although I personally would skip straight to
this part:-
| Quote: | add logging code (on entry&exit of
key procedures) to find out where things go wrong.
|
I do this everywhere now, in all my code during the debug process.
Make sure your errorlogger, however you do it, is threadsafe.
Dean
|
|
| Back to top |
|
 |
Martin James Guest
|
Posted: Tue Feb 24, 2004 12:46 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote
| Quote: | 1.If it is aborting silently, what can I do about it?
2.If is deadlocked can I take it out of this status? How?
|
Listener threads are usually just loops, basically:
repeat
listen;
newSocket:=accept;
startAclientThread(newSocket);
until forever;
It should be reasonably easy to log these operations to a file so as to
narrow down the problem area. There is only one listener thread, so you can
just open a file & write to it. There is the danger that the file
operations will slow down your listener thread to the point that your
original problem gets masked, OTOH, the extra delays may well show up your
bug earlier/with less loading.
The only way I can think of to log quicker is vastly more complex & needs a
dedicated logger thread & pool of buffers, so I would suggest the simple
file open/write as a first attempt. You could display the steps dirctly in
a memo or terminal component, but this again involves extra problems with
synchronizing or messaging the main thread.
There is probably an exception handler in the listener - don't forget to put
a log write of the exception.message in there too.
Rgds,
Martin
|
|
| Back to top |
|
 |
Laura Hilby Guest
|
Posted: Tue Feb 24, 2004 7:16 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
Thank you to Remy, Eric, Dean and Martin.
I realy appreciate it.
Because the problem doesn't happen that often and it happens only on my
client sites (I wasn't able to reproduce it on my developer or testing
machine) and my client doesn't bother to let me know all the time
it is hard to monitor and debug the problem. I added writting to a log in
the OnListenerException and now I just have to wait for it to happen again.
I think it is related to the high load on some days(the sites are movie
theatres).
A quick solution would be to add a client in the same app and use the client
to test the server once in a while and when the cleint is not connecting
just restart the server.
But the quick solution would not help me to find out what is realy
happening, for that I need to get into the socket code , there is no direct
access to the listener thread from what I know.
Does anyone know any way to access listener thread from anywere else beside
OnListenerException?
Thanks again,
Laura
"Martin James" <mjames_falcon (AT) dial (DOT) pipex.com> wrote
| Quote: |
"Laura Hilby" <lhilby (AT) eims-inc (DOT) com> wrote in message
news:403a75fe (AT) newsgroups (DOT) borland.com...
1.If it is aborting silently, what can I do about it?
2.If is deadlocked can I take it out of this status? How?
Listener threads are usually just loops, basically:
repeat
listen;
newSocket:=accept;
startAclientThread(newSocket);
until forever;
It should be reasonably easy to log these operations to a file so as to
narrow down the problem area. There is only one listener thread, so you
can
just open a file & write to it. There is the danger that the file
operations will slow down your listener thread to the point that your
original problem gets masked, OTOH, the extra delays may well show up
your
bug earlier/with less loading.
The only way I can think of to log quicker is vastly more complex & needs
a
dedicated logger thread & pool of buffers, so I would suggest the simple
file open/write as a first attempt. You could display the steps dirctly
in
a memo or terminal component, but this again involves extra problems with
synchronizing or messaging the main thread.
There is probably an exception handler in the listener - don't forget to
put
a log write of the exception.message in there too.
Rgds,
Martin
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 24, 2004 8:25 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Eric Jansen" <eric (AT) nohost (DOT) nl> wrote
| Quote: | If the listening thread is aborted silently (I don't know what
Remy means by this exactly; maybe an Abort exception or
a stack overflow)
|
I mean simply that that thread could detect a non-exception WinSock error
return value and then Terminate() itself.
| Quote: | The listening thread is probably running in a message loop
|
It is running a loop, but it has nothing to do with messages. It simply
calls accept() in a loop, which then blocks the thread until a new
connection arrives, at which time a new TIdPeerThread is created to handle
the connection, and the loop returns to call accept() again.
| Quote: | and in this loop you could increment a counter to see if
the thread is still running.
|
You have no access to, or control over,the listening thread, unless you
re-write Indy's source code. It is an internal thread for TIdTCPServer's
private use only.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 24, 2004 8:26 pm Post subject: Re: TIDTCPServer doesn't accept any connections at some poin |
|
|
"Martin James" <mjames_falcon (AT) dial (DOT) pipex.com> wrote
The listen is not performed in the loop, or even the same thread at all.
| Quote: | There is only one listener thread
|
There is one listener thread per Binding, not globally.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|